2019-02-26 03:49:51 +00:00
|
|
|
---
|
|
|
|
- block:
|
|
|
|
|
2019-07-12 04:12:48 +00:00
|
|
|
- name: update packages (Fedora Atomic)
|
2019-02-26 03:49:51 +00:00
|
|
|
atomic_host:
|
|
|
|
revision: latest
|
|
|
|
when: ansible_distribution == 'Fedora' and is_atomic
|
|
|
|
register: atomic_host_upgraded
|
|
|
|
|
2019-07-12 04:12:48 +00:00
|
|
|
- name: refresh and update packages (Fedora)
|
|
|
|
dnf:
|
|
|
|
name: "*"
|
|
|
|
state: latest
|
|
|
|
update_cache: yes
|
|
|
|
when: ansible_distribution == 'Fedora' and not is_atomic
|
|
|
|
register: fedora_upgraded
|
|
|
|
|
|
|
|
- name: update packages (generic - non-atomic/dnf)
|
2019-02-26 03:49:51 +00:00
|
|
|
package:
|
|
|
|
name: '*'
|
|
|
|
state: latest
|
2020-01-07 06:37:06 +00:00
|
|
|
when: ansible_distribution in ["CentOS", "Red Hat Enterprise Linux", "RedHat", "Debian", "Ubuntu"] and not is_atomic
|
2019-02-26 03:49:51 +00:00
|
|
|
register: host_upgraded
|
|
|
|
|
|
|
|
- name: reboot updated hosts
|
|
|
|
shell: nohup bash -c "sleep 2 && shutdown -r now" &
|
|
|
|
register: host_reset
|
2019-07-12 04:12:48 +00:00
|
|
|
when: (atomic_host_upgraded is changed) or (host_upgraded is changed) or (fedora_upgraded is changed)
|
2019-02-26 03:49:51 +00:00
|
|
|
|
|
|
|
- name: wait for rebooted host to return
|
|
|
|
wait_for_connection:
|
|
|
|
timeout: 300
|
|
|
|
delay: 20
|
|
|
|
when: host_reset is changed
|
2023-08-31 01:29:53 +00:00
|
|
|
become: true
|
2019-02-26 03:49:51 +00:00
|
|
|
tags:
|
|
|
|
- update
|