diff options
author | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2021-11-16 11:21:41 +0100 |
---|---|---|
committer | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2021-11-23 10:37:13 +0100 |
commit | 94c0eaa4457d4707045d8899fbe09582da181364 (patch) | |
tree | 026f675c52eb4aea8d49037f5d70dfec926f2456 | |
parent | 5735f00fed2e691517ad1aab33c2981882f2d474 (diff) |
[ANSIBLE] Setup cmctl autocompletion
Bash autocompletion code is generated to facilitate autocompletion
for cmctl command.
Change-Id: I03494293bf91aada54af70f6e0fd2c49e2feea64
Issue-ID: OOM-2871
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
-rw-r--r-- | ansible/roles/cert-manager/defaults/main.yml | 2 | ||||
-rw-r--r-- | ansible/roles/cert-manager/tasks/main.yml | 22 |
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 |