summaryrefslogtreecommitdiffstats
path: root/ansible/test/roles/prepare-kubectl/tasks/main.yml
blob: f75b0d09a58c4c9a530bb1957811ea563ee8e003 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
---
- name: "Ensure {{ app_data_path }} exists"
  file:
    path: "{{ app_data_path }}/downloads"
    state: directory
  when: not kubectl_install

- name: "Install kubectl-{{ kubectl_version }}"
  get_url:
    url: "https://dl.k8s.io/release/v{{ kubectl_version }}/bin/linux/amd64/kubectl"
    dest: "{{ '/usr/local/bin/kubectl' if kubectl_install else app_data_path+'/downloads/kubectl' }}"
    # This mode conditional allows checking if kubectl role, when installing kubectl, correctly
    # adds executable bit (bonus).
    mode: "{{ 0755 if kubectl_install else omit }}"