I am trying to create a really simple Ansible game that will restart the server and wait for it to return.
I had one in the past on Ansible 1.9 that worked, but I recently upgraded to 2.1.1.0 and it fails.
The host that I restart is called idm and has an IP of 192.168.200.23.
the player boots from my host 192.168.200.1 using the command
$ ansible-playbook reboot.yml -vvvv
This is a game in which I use
--- - hosts: idm tasks: - name: Restart server become: yes shell: sleep 2 && /sbin/shutdown -r now "Ansible system package upgraded" - name: waiting 60 secs for server to come back local_action: wait_for host=192.168.200.23 port=22 delay=60 connect_timeout=200 become: false
It restarts the machine perfectly, but almost immediately with an error
<192.168.200.23> ESTABLISH SSH CONNECTION FOR USER: root <192.168.200.23> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/myork/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.200.23 '/bin/sh -c '"'"'LANG=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1472242630.58-176546106960362/command; rm -rf "/root/.ansible/tmp/ansible-tmp-1472242630.58-176546106960362/" > /dev/null 2>&1 && sleep 0'"'"'' fatal: [idm]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh.", "unreachable": true}
Any idea what I missed here?
Thanks!
source share