--- # tasks file for ensure_os_upgrade - Fedora - name: Ensure System-upgrade Download when: - ansible_facts["system"] == 'Linux' - ansible_facts["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_facts["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_facts["system"] == 'Linux' - ansible_facts["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_facts["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_facts["system"] == 'Linux' - ansible_facts["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_facts["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