xoxys.network/handlers/main.yml

34 lines
926 B
YAML
Raw Normal View History

2017-05-18 21:10:07 +00:00
---
- name: Set flag require_reboot
2024-02-18 12:02:37 +00:00
ansible.builtin.set_fact:
__network_require_reboot: True
listen: __network_host_reboot
2024-02-18 12:02:37 +00:00
- name: Restart network
ansible.builtin.shell: "{{ __network_restart_command }}" # noqa command-instead-of-shell
changed_when: False
2024-02-18 12:02:37 +00:00
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
2017-05-18 21:10:07 +00:00
2024-02-18 12:02:37 +00:00
- name: Reboot server
ansible.builtin.reboot:
msg: "Reboot triggered by Ansible"
async: 1
poll: 0
ignore_errors: True # noqa ignore-errors
2024-02-18 12:02:37 +00:00
when: network_reboot_enabled | bool
listen: __network_host_reboot
2017-05-18 21:10:07 +00:00
2018-07-06 21:20:38 +00:00
- name: Waiting for host startup
2024-02-18 12:02:37 +00:00
ansible.builtin.wait_for_connection:
2018-07-01 22:39:35 +00:00
delay: 5
timeout: 300
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
- __network_host_reboot