add fedora-upgrade role, change package update headers to be more descriptive

This commit is contained in:
Josh Lay 2019-07-11 23:12:48 -05:00
parent c775852300
commit e278978195
5 changed files with 44 additions and 5 deletions

View file

@ -0,0 +1,4 @@
---
fedora_latest: 30
fedora_minimum: 29
fedora_target: "{{ fedora_latest|int }}"

View file

@ -0,0 +1,4 @@
---
- include_tasks: tasks.yml
when: (ansible_distribution in ["Fedora"] and not is_atomic) and (ansible_distribution_version != fedora_target and ansible_distribution_version >= fedora_minimum)

View file

@ -0,0 +1,23 @@
---
- name: install dnf-plugin-system-upgrade
dnf:
name: dnf-plugin-system-upgrade
state: present
- name: stage upgraded packages for fedora {{ fedora_target }}
shell: dnf -y system-upgrade download --releasever="{{ fedora_target }}"
warn: false
register: dnf_result
changed_when: "'Download complete' in dnf_result.stdout"
- name: trigger upgrade
shell: nohup bash -c 'sleep 2 && dnf system-upgrade reboot' &
register: upgraded_reset
when: (dnf_result is changed)
- name: wait for hosts to upgrade, reboot, and return
wait_for_connection:
timeout: 900
delay: 20
when: upgraded_reset is changed

View file

@ -1,23 +1,31 @@
--- ---
- block: - block:
- name: update packages (atomic) - name: update packages (Fedora Atomic)
atomic_host: atomic_host:
revision: latest revision: latest
when: ansible_distribution == 'Fedora' and is_atomic when: ansible_distribution == 'Fedora' and is_atomic
register: atomic_host_upgraded register: atomic_host_upgraded
- name: update packages (non-atomic) - 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)
package: package:
name: '*' name: '*'
state: latest state: latest
when: ansible_distribution in ["CentOS", "Red Hat Enterprise Linux", "Fedora", "Debian", "Ubuntu"] and not is_atomic when: ansible_distribution in ["CentOS", "Red Hat Enterprise Linux", "Debian", "Ubuntu"] and not is_atomic
register: host_upgraded register: host_upgraded
- name: reboot updated hosts - name: reboot updated hosts
shell: nohup bash -c "sleep 2 && shutdown -r now" & shell: nohup bash -c "sleep 2 && shutdown -r now" &
register: host_reset register: host_reset
when: (atomic_host_upgraded is changed) or (host_upgraded is changed) when: (atomic_host_upgraded is changed) or (host_upgraded is changed) or (fedora_upgraded is changed)
- name: wait for rebooted host to return - name: wait for rebooted host to return
wait_for_connection: wait_for_connection:

View file

@ -19,7 +19,7 @@
- name: install zfs-release package (Fedora) - name: install zfs-release package (Fedora)
dnf: dnf:
name: "http://download.zfsonlinux.org/fedora/zfs-release.fc29.noarch.rpm" name: "http://download.zfsonlinux.org/fedora/zfs-release.fc30.noarch.rpm"
state: present state: present
when: ansible_distribution in ["Fedora"] and not is_atomic when: ansible_distribution in ["Fedora"] and not is_atomic