2023-06-13 08:51:58 +08:00
|
|
|
---
|
|
|
|
- name: Get installed pip version
|
|
|
|
command: "{{ ansible_python_interpreter if ansible_python_interpreter is defined else 'python' }} -m pip --version"
|
|
|
|
register: pip_version_output
|
2024-08-28 13:30:56 +08:00
|
|
|
ignore_errors: true
|
2023-06-13 08:51:58 +08:00
|
|
|
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
|
2024-08-28 13:30:56 +08:00
|
|
|
ignore_errors: true
|
2023-06-13 08:51:58 +08:00
|
|
|
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)
|