diff --git a/roles/kubernetes-apps/helm/tasks/main.yml b/roles/kubernetes-apps/helm/tasks/main.yml index 5a89fb69c..0ac7edca9 100644 --- a/roles/kubernetes-apps/helm/tasks/main.yml +++ b/roles/kubernetes-apps/helm/tasks/main.yml @@ -17,6 +17,11 @@ package: name: "{{ pyyaml_package }}" state: present + when: pyyaml_package is defined + +- name: Helm | Install PyYaml [flatcar] + include_tasks: pyyaml-flatcar.yml + when: ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"] - name: Helm | Download helm include_tasks: "../../../download/tasks/download_file.yml" diff --git a/roles/kubernetes-apps/helm/tasks/pyyaml-flatcar.yml b/roles/kubernetes-apps/helm/tasks/pyyaml-flatcar.yml new file mode 100644 index 000000000..ea0d63a08 --- /dev/null +++ b/roles/kubernetes-apps/helm/tasks/pyyaml-flatcar.yml @@ -0,0 +1,22 @@ +--- +- name: Get installed pip version + command: "{{ ansible_python_interpreter if ansible_python_interpreter is defined else 'python' }} -m pip --version" + register: pip_version_output + ignore_errors: yes + changed_when: false + +- name: Get installed PyYAML version + command: "{{ ansible_python_interpreter if ansible_python_interpreter is defined else 'python' }} -m pip show PyYAML" + register: pyyaml_version_output + ignore_errors: yes + changed_when: false + +- name: Install pip + command: "{{ ansible_python_interpreter if ansible_python_interpreter is defined else 'python' }} -m ensurepip --upgrade" + when: (pyyaml_version_output is failed) and (pip_version_output is failed) + +- name: Install PyYAML + ansible.builtin.pip: + name: + - PyYAML + when: (pyyaml_version_output is failed)