xoxys.network/handlers/main.yml
Robert Kaussow e10db650e6
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/docs Pipeline was successful
ci/woodpecker/push/notify Pipeline was successful
cleanup unused tags
2024-09-29 21:54:11 +02:00

34 lines
926 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 }}" # 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
- 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