|
11 | 11 | tasks: |
12 | 12 | - meta: end_play |
13 | 13 | when: |
14 | | - # TODO CI currently runs on macOS 12 & which isn't supported by Podman |
15 | | - # version available in Homebrew. |
| 14 | + # Podman versions available in Homebrew have dropped macOS 12 support. |
16 | 15 | - ansible_facts.system == 'Darwin' |
17 | 16 | - ansible_facts.distribution_version is version('13.0', '<', strict=True) |
18 | 17 |
|
| 18 | + - meta: end_play |
| 19 | + when: |
| 20 | + # Ansible 10 (ansible-core 2.17+) require Python 3.7+ on targets. |
| 21 | + # On CentOS 8 /usr/libexec/platform-python is Python 3.6 |
| 22 | + - ansible_version.full is version('2.17', '>=', strict=True) |
| 23 | + |
19 | 24 | - name: set up test container and run tests inside it |
20 | 25 | block: |
21 | 26 | - name: install deps |
|
33 | 38 | - cmd: podman info |
34 | 39 | timeout: 300 |
35 | 40 | register: podman_machine |
| 41 | + changed_when: true |
36 | 42 |
|
37 | 43 | - debug: |
38 | 44 | var: podman_machine |
|
41 | 47 | - name: create container |
42 | 48 | command: |
43 | 49 | cmd: podman run --name testMitogen -d --rm centos:8 bash -c "sleep infinity & wait" |
| 50 | + changed_when: true |
44 | 51 |
|
45 | 52 | - name: add container to inventory |
46 | 53 | add_host: |
47 | 54 | name: testMitogen |
48 | 55 | ansible_connection: podman |
| 56 | + ansible_python_interpreter: /usr/libexec/platform-python # Python 3.6 |
49 | 57 | ansible_user: root |
50 | 58 | changed_when: false |
51 | 59 | environment: |
|
57 | 65 | - name: create test file |
58 | 66 | file: |
59 | 67 | path: /var/run/reboot-required |
| 68 | + mode: u=rw,go=r |
60 | 69 | state: touch |
61 | 70 |
|
62 | 71 | - name: Check if reboot is required |
|
68 | 77 | shell: sleep 2 && shutdown -r now "Ansible updates triggered" |
69 | 78 | async: 1 |
70 | 79 | poll: 0 |
71 | | - when: reboot_required.stat.exists == True |
| 80 | + changed_when: true |
| 81 | + when: |
| 82 | + - reboot_required.stat.exists |
72 | 83 |
|
73 | 84 | - name: Wait 300 seconds for server to become available |
74 | 85 | wait_for_connection: |
75 | 86 | delay: 30 |
76 | 87 | timeout: 300 |
77 | | - when: reboot_required.stat.exists == True |
| 88 | + when: |
| 89 | + - reboot_required.stat.exists |
78 | 90 |
|
79 | 91 | - name: cleanup test file |
80 | 92 | file: |
|
90 | 102 | loop: |
91 | 103 | - cmd: podman stop testMitogen |
92 | 104 | - cmd: podman machine stop |
| 105 | + changed_when: true |
93 | 106 | when: |
94 | 107 | - ansible_facts.pkg_mgr in ['homebrew'] |
95 | 108 | tags: |
|
0 commit comments