- name: restart machine
shell: sleep 2 && shutdown -r now "Ansible updates triggered"
async: 1
poll: 0
sudo: true
ignore_errors: true
- name: waiting for server to come back
local_action: wait_for host={{ static_ip }} state=started delay=30 timeout=300
sudo: false
fatal: [192.168.0.11]: FAILED! => {
"changed": false,
"failed": true,
"module_stderr": "Shared connection to 192.168.0.11 closed.\r\n",
"module_stdout": "\r\n/bin/sh: 1: /home/pi/.ansible/tmp/ansible-tmp-1481969769.79-144484795431651/async_wrapper.py: not found\r\n",
"msg": "MODULE FAILURE"
}
If you set async to 0 then it doesn't generate the error, but you get a different error because you can't reboot on a synchronous command.
Ideas?