2017-05-18 21:10:07 +00:00
|
|
|
---
|
2022-11-11 20:51:36 +00:00
|
|
|
- name: Set flag require_reboot
|
|
|
|
set_fact:
|
|
|
|
__network_require_reboot: True
|
|
|
|
listen: __network_host_reboot
|
|
|
|
|
2018-07-07 17:37:56 +00:00
|
|
|
- block:
|
2019-01-09 20:51:48 +00:00
|
|
|
- name: Restart network
|
2022-10-10 13:17:16 +00:00
|
|
|
shell: "{{ __network_restart_command }}"
|
2019-01-09 20:51:48 +00:00
|
|
|
async: 1
|
|
|
|
poll: 0
|
2022-11-10 21:02:01 +00:00
|
|
|
when:
|
2023-03-13 20:36:49 +00:00
|
|
|
- (not __network_require_reboot | default(False) | bool) or (not network_reboot_enabled | bool)
|
2022-11-10 21:02:01 +00:00
|
|
|
- network_restart_enabled | bool
|
2019-01-09 20:51:48 +00:00
|
|
|
listen: __network_restart
|
2022-10-11 07:48:18 +00:00
|
|
|
tags:
|
|
|
|
- skip_ansible_later
|
2017-05-18 21:10:07 +00:00
|
|
|
|
2019-01-09 20:51:48 +00:00
|
|
|
- name: Reboot server
|
2022-10-11 07:48:18 +00:00
|
|
|
reboot:
|
|
|
|
msg: "Reboot triggered by Ansible"
|
2019-01-09 20:51:48 +00:00
|
|
|
async: 1
|
|
|
|
poll: 0
|
2019-06-21 06:06:43 +00:00
|
|
|
ignore_errors: yes
|
2022-11-11 20:51:36 +00:00
|
|
|
when: network_reboot_enabled | bool
|
|
|
|
listen: __network_host_reboot
|
2018-07-07 17:37:56 +00:00
|
|
|
become: True
|
2019-01-09 20:51:48 +00:00
|
|
|
become_user: root
|
2017-05-18 21:10:07 +00:00
|
|
|
|
2018-07-06 21:20:38 +00:00
|
|
|
- name: Waiting for host startup
|
|
|
|
wait_for_connection:
|
2018-07-01 22:39:35 +00:00
|
|
|
delay: 5
|
|
|
|
timeout: 300
|
2022-11-11 20:51:36 +00:00
|
|
|
when: (network_reboot_enabled | bool) or (network_restart_enabled | bool)
|
2017-05-18 21:10:07 +00:00
|
|
|
listen:
|
2019-01-09 20:51:48 +00:00
|
|
|
- __network_restart
|
2022-11-11 20:51:36 +00:00
|
|
|
- __network_host_reboot
|