summaryrefslogtreecommitdiffstats
path: root/ansible/roles/kubectl/tasks/main.yml
blob: 03b9f9b028cbe62a6b64d475a0597825cbf843f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
---
- name: Install kubectl
  copy:
    src: "{{ app_data_path }}/downloads/kubectl"
    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