summaryrefslogtreecommitdiffstats
path: root/ansible/test/roles/prepare-kubectl/tasks/main.yml
blob: b56318505f97ce134903a81c4060d06dd730df03 (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://storage.googleapis.com/kubernetes-release/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 }}"