Skip to content

Commit

Permalink
[flatcar] add python dependency check for helm-apps (#10192)
Browse files Browse the repository at this point in the history
* add pyyaml install via task instead of package

* Change condition for better consistency in the codebase
  • Loading branch information
palmeXx authored Jun 13, 2023
1 parent f8fadf5 commit 775851b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions roles/kubernetes-apps/helm/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
22 changes: 22 additions & 0 deletions roles/kubernetes-apps/helm/tasks/pyyaml-flatcar.yml
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 775851b

Please sign in to comment.