summaryrefslogtreecommitdiffstats
path: root/ansible
diff options
context:
space:
mode:
Diffstat (limited to 'ansible')
-rw-r--r--ansible/roles/cert-manager/defaults/main.yml2
-rw-r--r--ansible/roles/cert-manager/tasks/main.yml22
2 files changed, 24 insertions, 0 deletions
diff --git a/ansible/roles/cert-manager/defaults/main.yml b/ansible/roles/cert-manager/defaults/main.yml
index aa59c240..81a66f4e 100644
--- a/ansible/roles/cert-manager/defaults/main.yml
+++ b/ansible/roles/cert-manager/defaults/main.yml
@@ -7,3 +7,5 @@ cert_manager:
helm_values:
installCRDs: true
cmctl_bin_dir: /usr/local/bin
+completion_dir: /etc/bash_completion.d
+completion_package: bash-completion
diff --git a/ansible/roles/cert-manager/tasks/main.yml b/ansible/roles/cert-manager/tasks/main.yml
index 9bf7fde3..77063655 100644
--- a/ansible/roles/cert-manager/tasks/main.yml
+++ b/ansible/roles/cert-manager/tasks/main.yml
@@ -29,3 +29,25 @@
- 'cmctl'
remote_src: true
mode: 0755
+
+- name: Install completion for the bash shell
+ package:
+ name: "{{ completion_package }}"
+ state: present
+
+- name: Generate shell autocompletion code for cmctl
+ command: cmctl completion bash
+ register: cmctl_completion
+ changed_when: false
+
+- name: Ensure bash completion dir exists
+ file:
+ path: "{{ completion_dir }}"
+ state: directory
+ mode: 0755
+
+- name: Install bash autocompletion code for cmctl
+ copy:
+ content: "{{ cmctl_completion.stdout }}"
+ dest: "{{ completion_dir }}/cmctl"
+ mode: 0644