--- - 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 }}"