/
pip.yml
82 lines (72 loc) · 2.57 KB
/
pip.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
# TODO: Still open?
# The pip module always set to changed when using check mode #62826
# https://github.com/ansible/ansible/issues/62826
# Note 1.
# The pip module isn't always idempotent #28952
# https://github.com/ansible/ansible/issues/28952
# The isssue was closed. See the Conclusion
- name: Install Ansible Runner PyPI packages for ar_owner
block:
- name: "Pip: Install Ansible Runner PyPI packages for {{ ar_owner }}"
become_user: "{{ ar_owner }}"
become: true
changed_when:
- result.changed
- not ansible_check_mode
ansible.builtin.pip:
name: "{{ item.name }}"
executable: "{{ ar_pip_executable }}"
extra_args: "{{ ar_pip_extraagrs | d(omit) }}"
version: "{{ item.version | d(omit) }}"
state: "{{ item.state | d(omit) }}"
loop: "{{ ar_pip_packages }}"
register: result
until: result is succeeded
retries: "{{ pip_install_retries }}"
delay: "{{ pip_install_delay }}"
- name: "Pip: Debug PyPI packages"
ansible.builtin.debug:
var: result
when: ar_debug | bool or ansible_check_mode
rescue:
- name: "Pip: Rescue PyPI packages"
ansible.builtin.fail:
msg: |
[ERR] task {{ ansible_failed_task.name }} failed.
ansible_failed_task:
{{ ansible_failed_task | to_yaml(indent=2) | indent(2) }}
ansible_failed_result:
{{ ansible_failed_result | to_yaml(indent=2) | indent(2) }}
- name: Install Ansible Runner PyPI requirements for ar_owner
block:
- name: "Pip: Install Ansible Runner pip requirements for {{ ar_owner }}"
become_user: "{{ ar_owner }}"
become: true
changed_when:
- result.changed
- not ansible_check_mode
ansible.builtin.pip:
requirements: "{{ ar_pip_requirements }}"
executable: "{{ ar_pip_executable }}"
extra_args: "{{ pip_extraagrs | d(omit) }}"
register: result
until: result is succeeded
retries: "{{ pip_install_retries }}"
delay: "{{ pip_install_delay }}"
when: ar_pip_requirements | length > 0
- name: "Pip: Debug PyPI requirements"
ansible.builtin.debug:
var: result
when: ar_debug | bool
rescue:
- name: "Pip: Rescue PyPI requirements"
ansible.builtin.fail:
msg: |
[ERR] task {{ ansible_failed_task.name }} failed.
ansible_failed_task:
{{ ansible_failed_task | to_yaml(indent=2) | indent(2) }}
ansible_failed_result:
{{ ansible_failed_result | to_yaml(indent=2) | indent(2) }}
# EOF
...