summaryrefslogtreecommitdiffstats
path: root/ansible/roles/kubectl/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles/kubectl/tasks/main.yml')
-rw-r--r--ansible/roles/kubectl/tasks/main.yml22
1 files changed, 22 insertions, 0 deletions
diff --git a/ansible/roles/kubectl/tasks/main.yml b/ansible/roles/kubectl/tasks/main.yml
index 7c77c3c5..03b9f9b0 100644
--- a/ansible/roles/kubectl/tasks/main.yml
+++ b/ansible/roles/kubectl/tasks/main.yml
@@ -5,3 +5,25 @@
dest: "{{ kubectl_bin_dir }}/kubectl"
remote_src: true
mode: 0755
+
+- name: Install completion for the bash shell
+ package:
+ name: "{{ completion_package }}"
+ state: present
+
+- name: Generate shell autocompletion code for kubectl
+ command: kubectl completion bash
+ register: kubectl_completion
+ changed_when: false
+
+- name: Ensure bash completion dir exists
+ file:
+ path: "{{ completion_dir }}"
+ state: directory
+ mode: 0755
+
+- name: Install bash autocompletion code for kubectl
+ copy:
+ content: "{{ kubectl_completion.stdout }}"
+ dest: "{{ completion_dir }}/kubectl"
+ mode: 0644