xoxys.network/handlers/main.yml

31 lines
583 B
YAML
Raw Normal View History

2017-05-18 21:10:07 +00:00
---
- 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.config[network.defaultif].ipaddr }}
port=22
delay=1
timeout=300
listen:
- "network_restart"
- "host_reboot"