--- - name: Set flag require_reboot ansible.builtin.set_fact: __network_require_reboot: True listen: __network_host_reboot - name: Restart network ansible.builtin.shell: "{{ __network_restart_command }}" # noqa command-instead-of-shell changed_when: False async: 1 poll: 0 when: - (not __network_require_reboot | default(False) | bool) or (not network_reboot_enabled | bool) - network_restart_enabled | bool listen: __network_restart tags: - skip_ansible_later - name: Reboot server ansible.builtin.reboot: msg: "Reboot triggered by Ansible" async: 1 poll: 0 ignore_errors: True # noqa ignore-errors when: network_reboot_enabled | bool listen: __network_host_reboot - name: Waiting for host startup ansible.builtin.wait_for_connection: delay: 5 timeout: 300 when: (network_reboot_enabled | bool) or (network_restart_enabled | bool) listen: - __network_restart - __network_host_reboot