|
1 | 1 | ---
|
2 | 2 | # set ft=ansible
|
3 | 3 | #
|
| 4 | +- set_fact: |
| 5 | + real_ansible_host: "{{ ansible_host }}" |
| 6 | + timeout: "{{ cli_reboot_timeout | default('300') }}" |
4 | 7 |
|
5 |
| -- import_role: |
6 |
| - name: rpm_ostree_install |
7 |
| - vars: |
8 |
| - roi_packages: "{{ g_pkg1 }}" |
9 |
| - roi_reboot: true |
| 8 | +# Have to account for both because Fedora STR uses the old version of these |
| 9 | +# inventory values for some reason. |
| 10 | +- when: ansible_port is defined |
| 11 | + set_fact: |
| 12 | + real_ansible_port: "{{ ansible_port }}" |
| 13 | + |
| 14 | +- when: ansible_ssh_port is defined |
| 15 | + set_fact: |
| 16 | + real_ansible_port: "{{ ansible_ssh_port }}" |
| 17 | + |
| 18 | +- name: Get original bootid |
| 19 | + command: cat /proc/sys/kernel/random/boot_id |
| 20 | + register: orig_bootid |
| 21 | + |
| 22 | +- name: Package layer {{ g_pkg1 }} with reboot flag |
| 23 | + command: rpm-ostree install {{ g_pkg1 | quote }} -r |
| 24 | + async: 60 |
| 25 | + poll: 0 |
| 26 | + ignore_errors: true |
| 27 | + |
| 28 | +- name: wait for hosts to come back up |
| 29 | + local_action: |
| 30 | + wait_for host={{ real_ansible_host }} |
| 31 | + port={{ real_ansible_port | default('22') }} |
| 32 | + state=started |
| 33 | + delay=30 |
| 34 | + timeout={{ timeout }} |
| 35 | + search_regex="OpenSSH" |
| 36 | + become: false |
| 37 | + |
| 38 | +# I'm not sure the retries are even necessary, but I'm keeping them in |
| 39 | +- name: Wait until bootid changes |
| 40 | + command: cat /proc/sys/kernel/random/boot_id |
| 41 | + register: new_bootid |
| 42 | + until: new_bootid.stdout != orig_bootid.stdout |
| 43 | + retries: 6 |
| 44 | + delay: 10 |
10 | 45 |
|
11 | 46 | - import_role:
|
12 | 47 | name: rpm_ostree_install_verify
|
13 | 48 | vars:
|
14 | 49 | roiv_package_name: "{{ g_pkg1 }}"
|
15 | 50 | roiv_binary_name: "{{ g_pkg1 }}"
|
16 | 51 |
|
17 |
| -- import_role: |
18 |
| - name: rpm_ostree_uninstall |
19 |
| - vars: |
20 |
| - rou_packages: "{{ g_pkg1 }}" |
21 |
| - rou_reboot: true |
| 52 | +- name: Get original bootid |
| 53 | + command: cat /proc/sys/kernel/random/boot_id |
| 54 | + register: orig_bootid |
| 55 | + |
| 56 | +- name: Remove {{ g_pkg1 }} with reboot flag |
| 57 | + command: rpm-ostree uninstall {{ g_pkg1 | quote }} -r |
| 58 | + async: 60 |
| 59 | + poll: 0 |
| 60 | + ignore_errors: true |
| 61 | + |
| 62 | +- name: wait for hosts to come back up |
| 63 | + local_action: |
| 64 | + wait_for host={{ real_ansible_host }} |
| 65 | + port={{ real_ansible_port | default('22') }} |
| 66 | + state=started |
| 67 | + delay=30 |
| 68 | + timeout={{ timeout }} |
| 69 | + search_regex="OpenSSH" |
| 70 | + become: false |
| 71 | + |
| 72 | +# I'm not sure the retries are even necessary, but I'm keeping them in |
| 73 | +- name: Wait until bootid changes |
| 74 | + command: cat /proc/sys/kernel/random/boot_id |
| 75 | + register: new_bootid |
| 76 | + until: new_bootid.stdout != orig_bootid.stdout |
| 77 | + retries: 6 |
| 78 | + delay: 10 |
22 | 79 |
|
23 | 80 | - import_role:
|
24 | 81 | name: rpm_ostree_uninstall_verify
|
|
0 commit comments