If we know how to upgrade Fedora via DNF... do it.
This commit is contained in:
		| @@ -61,8 +61,53 @@ | |||||||
|   notify: |   notify: | ||||||
|     - 'ensure_os_upgrade.package_facts' |     - 'ensure_os_upgrade.package_facts' | ||||||
|     - 'ensure_os_upgrade.service_facts' |     - 'ensure_os_upgrade.service_facts' | ||||||
|  | - name: 'Ensure system-upgrade download' | ||||||
|  |   when: | ||||||
|  |     - ansible_system == 'Linux' | ||||||
|  |     - ansible_distribution == 'Fedora' | ||||||
|  |     - ensure_os_upgrade is defined | ||||||
|  |     - ensure_os_upgrade.package_list is defined | ||||||
|  |     - ensure_os_upgrade.package_list is iterable | ||||||
|  |     - ensure_os_upgrade.target_version is defined | ||||||
|  |     - ansible_distribution_major_version|int < ensure_os_upgrade.target_version|int | ||||||
|  |   ansible.builtin.shell: > | ||||||
|  |     dnf -y system-upgrade download --refresh --releasever={{ ensure_os_upgrade.target_version|int }} | ||||||
|  | - name: 'Ensure system-upgrade reboot' | ||||||
|  |   when: | ||||||
|  |     - ansible_system == 'Linux' | ||||||
|  |     - ansible_distribution == 'Fedora' | ||||||
|  |     - ensure_os_upgrade is defined | ||||||
|  |     - ensure_os_upgrade.package_list is defined | ||||||
|  |     - ensure_os_upgrade.package_list is iterable | ||||||
|  |     - ensure_os_upgrade.target_version is defined | ||||||
|  |     - ansible_distribution_major_version|int < ensure_os_upgrade.target_version|int | ||||||
|  |   async: '1' | ||||||
|  |   poll: '0' | ||||||
|  |   ansible.builtin.shell: > | ||||||
|  |     sleep 5 && dnf -y system-upgrade reboot | ||||||
|  | - name: 'Wait for the reboot' | ||||||
|  |   when: | ||||||
|  |     - ansible_system == 'Linux' | ||||||
|  |     - ansible_distribution == 'Fedora' | ||||||
|  |     - ensure_os_upgrade is defined | ||||||
|  |     - ensure_os_upgrade.package_list is defined | ||||||
|  |     - ensure_os_upgrade.package_list is iterable | ||||||
|  |     - ensure_os_upgrade.target_version is defined | ||||||
|  |     - ansible_distribution_major_version|int < ensure_os_upgrade.target_version|int | ||||||
|  |   ansible.builtin.wait_for: | ||||||
|  |     connect_timeout: '5' | ||||||
|  |     delay: '300' | ||||||
|  |     host: '{{ (ansible_ssh_host|default(ansible_host))|default(inventory_hostname) }}' | ||||||
|  |     port: '22' | ||||||
|  |     search_regex: 'OpenSSH' | ||||||
|  |     sleep: '15' | ||||||
|  |     timeout: '1800' | ||||||
|  |   vars: | ||||||
|  |     ansible_connection: 'local' | ||||||
|  | - name: 'Gather facts' | ||||||
|  |   ansible.builtin.setup: | ||||||
|  |   notify: | ||||||
|  |     - 'ensure_os_upgrade.package_facts' | ||||||
|  |     - 'ensure_os_upgrade.service_facts' | ||||||
| - name: 'flush handlers' | - name: 'flush handlers' | ||||||
|   meta: 'flush_handlers' |   meta: 'flush_handlers' | ||||||
		Reference in New Issue
	
	Block a user