xoxys.network/handlers/main.yml
2017-12-10 17:11:05 +01:00

30 lines
586 B
YAML

---
- name: Restart network
shell: sleep 2 && systemctl restart network
async: 1
poll: 0
ignore_errors: true
when: not require_reboot
listen:
- "network_restart"
- name: Reboot server
shell: sleep 2 && shutdown -r now "Reboot triggered by Ansible"
async: 1
poll: 0
ignore_errors: true
when: require_reboot
listen:
- "host_reboot"
- name: Wait for host
local_action:
module: wait_for
host={{ network_interfaces[network_defaultif].ipaddr }}
port=22
delay=1
timeout=300
listen:
- "network_restart"
- "host_reboot"