xoxys.network/handlers/main.yml
Robert Kaussow 893dff1d8c
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/notify Pipeline was successful
ci/woodpecker/push/docs Pipeline was successful
ci: migrate to woodpecker
2024-02-18 13:02:37 +01:00

35 lines
884 B
YAML

---
- 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 }}"
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
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