Hi,
I am
following
https://support.ansible.com/hc/en-us/articles/201958037-Reboot-a-server-and-wait-for-it-to-come-back
trying to use ansible to reboot hosts.
My problem is that the wait_for always reaches the full timeout+delay
(without failure). why is that?
Any help would be appreciated.
Regards
Ansible 1.9.4
Tested on Fedora 23 and RHEL 7
role:
---
- 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
delegate_to: localhost
sudo: no
wait_for:
host: "{{ host }}"
state: started
delay: "{{ boot_delay }}"
timeout: "{{ boot_timeout }}"
- name: wait for ssh
delegate_to: localhost
sudo: no
wait_for:
host: "{{ host }}"
port: "{{ ssh_port }}"
search_regex: OpenSSH
timeout: "{{ ssh_timeout }}"
log:
08:51:55 TASK: [system/reboot | restart machine]
***************************************
> 08:51:55 [[ previous task time: 0:00:02.434997 = 2.43s /
> 122.88s ]]
> 08:51:55 <MYIP.166> ESTABLISH CONNECTION FOR USER: cloud-user
> 08:51:55 <MYIP.163> ESTABLISH CONNECTION FOR USER: cloud-user
> 08:51:55 <MYIP.166> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o
> ControlPersist=60s -o ControlPath="/home/rhos-ci/.ansible/cp/%h-%r" -o
> StrictHostKeyChecking=no -o
> IdentityFile="/home/rhos-ci/.ssh/rhos-jenkins/id_rsa" -o
> KbdInteractiveAuthentication=no -o
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o
> PasswordAuthentication=no -o User=cloud-user -o ConnectTimeout=30 MYIP.166
> /bin/sh -c 'mkdir -p
> $HOME/.ansible/tmp/ansible-tmp-1455526316.25-102015492510284 && chmod a+rx
> $HOME/.ansible/tmp/ansible-tmp-1455526316.25-102015492510284 && echo
> $HOME/.ansible/tmp/ansible-tmp-1455526316.25-102015492510284'
> 08:51:55 <MYIP.163> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o
> ControlPersist=60s -o ControlPath="/home/rhos-ci/.ansible/cp/%h-%r" -o
> StrictHostKeyChecking=no -o
> IdentityFile="/home/rhos-ci/.ssh/rhos-jenkins/id_rsa" -o
> KbdInteractiveAuthentication=no -o
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o
> PasswordAuthentication=no -o User=cloud-user -o ConnectTimeout=30 MYIP.163
> /bin/sh -c 'mkdir -p
> $HOME/.ansible/tmp/ansible-tmp-1455526316.25-267729371846854 && chmod a+rx
> $HOME/.ansible/tmp/ansible-tmp-1455526316.25-267729371846854 && echo
> $HOME/.ansible/tmp/ansible-tmp-1455526316.25-267729371846854'
> 08:51:56 <MYIP.163> PUT /tmp/tmp3GXDDT TO
> /home/cloud-user/.ansible/tmp/ansible-tmp-1455526316.25-267729371846854/command
> 08:51:56 <MYIP.166> PUT /tmp/tmpyYlfp6 TO
> /home/cloud-user/.ansible/tmp/ansible-tmp-1455526316.25-102015492510284/command
> 08:51:56 <MYIP.166> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o
> ControlPersist=60s -o ControlPath="/home/rhos-ci/.ansible/cp/%h-%r" -o
> StrictHostKeyChecking=no -o
> IdentityFile="/home/rhos-ci/.ssh/rhos-jenkins/id_rsa" -o
> KbdInteractiveAuthentication=no -o
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o
> PasswordAuthentication=no -o User=cloud-user -o ConnectTimeout=30 MYIP.166
> /bin/sh -c 'chmod a+rx
> /home/cloud-user/.ansible/tmp/ansible-tmp-1455526316.25-102015492510284/command'
> 08:51:56 <MYIP.163> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o
> ControlPersist=60s -o ControlPath="/home/rhos-ci/.ansible/cp/%h-%r" -o
> StrictHostKeyChecking=no -o
> IdentityFile="/home/rhos-ci/.ssh/rhos-jenkins/id_rsa" -o
> KbdInteractiveAuthentication=no -o
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o
> PasswordAuthentication=no -o User=cloud-user -o ConnectTimeout=30 MYIP.163
> /bin/sh -c 'chmod a+rx
> /home/cloud-user/.ansible/tmp/ansible-tmp-1455526316.25-267729371846854/command'
> 08:51:58 <MYIP.166> PUT /tmp/tmpiwexbq TO
> /home/cloud-user/.ansible/tmp/ansible-tmp-1455526316.25-102015492510284/async_wrapper
> 08:51:58 <MYIP.166> PUT /tmp/tmp2KUMFy TO
> /home/cloud-user/.ansible/tmp/ansible-tmp-1455526316.25-102015492510284/arguments
> 08:51:59 <MYIP.166> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o
> ControlPersist=60s -o ControlPath="/home/rhos-ci/.ansible/cp/%h-%r" -o
> StrictHostKeyChecking=no -o
> IdentityFile="/home/rhos-ci/.ssh/rhos-jenkins/id_rsa" -o
> KbdInteractiveAuthentication=no -o
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o
> PasswordAuthentication=no -o User=cloud-user -o ConnectTimeout=30 MYIP.166
> /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible,
> key=htvpdgrlpaudqdumhtbxareaujjdjqcv] password: " -u root /bin/sh -c
> '"'"'echo BECOME-SUCCESS-htvpdgrlpaudqdumhtbxareaujjdjqcv; LANG=en_US.UTF-8
> LC_CTYPE=en_US.UTF-8 /usr/bin/python
> /home/cloud-user/.ansible/tmp/ansible-tmp-1455526316.25-102015492510284/async_wrapper
> 825605699498 1
> /home/cloud-user/.ansible/tmp/ansible-tmp-1455526316.25-102015492510284/command
>
> /home/cloud-user/.ansible/tmp/ansible-tmp-1455526316.25-102015492510284/arguments;
> rm -rf
> /home/cloud-user/.ansible/tmp/ansible-tmp-1455526316.25-102015492510284/
> >/dev/null 2>&1'"'"''
> 08:52:02 <MYIP.163> PUT /tmp/tmpF28EFi TO
> /home/cloud-user/.ansible/tmp/ansible-tmp-1455526316.25-267729371846854/async_wrapper
> 08:52:03 <MYIP.163> PUT /tmp/tmpzpZmbU TO
> /home/cloud-user/.ansible/tmp/ansible-tmp-1455526316.25-267729371846854/arguments
> 08:52:04 <MYIP.163> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o
> ControlPersist=60s -o ControlPath="/home/rhos-ci/.ansible/cp/%h-%r" -o
> StrictHostKeyChecking=no -o
> IdentityFile="/home/rhos-ci/.ssh/rhos-jenkins/id_rsa" -o
> KbdInteractiveAuthentication=no -o
> PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o
> PasswordAuthentication=no -o User=cloud-user -o ConnectTimeout=30 MYIP.163
> /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible,
> key=iyfcjajmdrtfgzgpkavjhaqolmcunhbi] password: " -u root /bin/sh -c
> '"'"'echo BECOME-SUCCESS-iyfcjajmdrtfgzgpkavjhaqolmcunhbi; LANG=en_US.UTF-8
> LC_CTYPE=en_US.UTF-8 /usr/bin/python
> /home/cloud-user/.ansible/tmp/ansible-tmp-1455526316.25-267729371846854/async_wrapper
> 825605699498 1
> /home/cloud-user/.ansible/tmp/ansible-tmp-1455526316.25-267729371846854/command
>
> /home/cloud-user/.ansible/tmp/ansible-tmp-1455526316.25-267729371846854/arguments;
> rm -rf
> /home/cloud-user/.ansible/tmp/ansible-tmp-1455526316.25-267729371846854/
> >/dev/null 2>&1'"'"''
> 08:52:11 <job 825605699498.9622> finished on
> r4mjw-rhos-ci-1120-rh-pud-pksk-controller
> 08:52:11 <job 825605699498.9594> finished on
> r4mjw-rhos-ci-1120-rh-pud-pksk-tester
> 08:52:11
> 08:52:11 TASK: [system/reboot | waiting for server to come back]
> ***********************
> 08:52:11 [[ previous task time: 0:00:16.000378 = 16.00s /
> 138.88s ]]
> 08:52:11 <localhost> REMOTE_MODULE wait_for timeout=60 state=started
> host=MYIP.163 delay=30
> 08:52:11 <localhost> REMOTE_MODULE wait_for timeout=60 state=started
> host=MYIP.166 delay=30
> 08:52:11 <localhost> EXEC ['/bin/sh', '-c', 'mkdir -p
> $HOME/.ansible/tmp/ansible-tmp-1455526332.24-9545141356176 && chmod a+rx
> $HOME/.ansible/tmp/ansible-tmp-1455526332.24-9545141356176 && echo
> $HOME/.ansible/tmp/ansible-tmp-1455526332.24-9545141356176']
> 08:52:11 <localhost> EXEC ['/bin/sh', '-c', 'mkdir -p
> $HOME/.ansible/tmp/ansible-tmp-1455526332.25-171967457531892 && chmod a+rx
> $HOME/.ansible/tmp/ansible-tmp-1455526332.25-171967457531892 && echo
> $HOME/.ansible/tmp/ansible-tmp-1455526332.25-171967457531892']
> 08:52:11 <localhost> PUT /tmp/tmpA5CJJW TO
> /home/rhos-ci/.ansible/tmp/ansible-tmp-1455526332.24-9545141356176/wait_for
> 08:52:11 <localhost> PUT /tmp/tmpXqOkiZ TO
> /home/rhos-ci/.ansible/tmp/ansible-tmp-1455526332.25-171967457531892/wait_for
> 08:52:11 <localhost> EXEC ['/bin/sh', '-c', u'LANG=en_US.UTF-8
> LC_CTYPE=en_US.UTF-8 /usr/bin/python
> /home/rhos-ci/.ansible/tmp/ansible-tmp-1455526332.24-9545141356176/wait_for;
> rm -rf /home/rhos-ci/.ansible/tmp/ansible-tmp-1455526332.24-9545141356176/
> >/dev/null 2>&1']
> 08:52:11 <localhost> EXEC ['/bin/sh', '-c', u'LANG=en_US.UTF-8
> LC_CTYPE=en_US.UTF-8 /usr/bin/python
> /home/rhos-ci/.ansible/tmp/ansible-tmp-1455526332.25-171967457531892/wait_for;
> rm -rf /home/rhos-ci/.ansible/tmp/ansible-tmp-1455526332.25-171967457531892/
> >/dev/null 2>&1']
> 08:53:42 ok: [r4mjw-rhos-ci-1120-rh-pud-pksk-controller -> localhost] =>
> {"changed": false, "elapsed": 90, "path": null, "port": null, "search_regex":
> null, "state": "started"}
> 08:53:42 ok: [r4mjw-rhos-ci-1120-rh-pud-pksk-tester -> localhost] =>
> {"changed": false, "elapsed": 90, "path": null, "port": null, "search_regex":
> null, "state": "started"}
> 08:53:42
> 08:53:42 TASK: [system/reboot | wait for ssh]
> ******************************************
> 08:53:42 [[ previous task time: 0:01:30.401150 = 90.40s /
> 229.28s ]]
> 08:53:42 <localhost> REMOTE_MODULE wait_for timeout=300 port=22 host=MYIP.163
> search_regex=OpenSSH
> 08:53:42 <localhost> EXEC ['/bin/sh', '-c', 'mkdir -p
> $HOME/.ansible/tmp/ansible-tmp-1455526422.6-137666143168273 && chmod a+rx
> $HOME/.ansible/tmp/ansible-tmp-1455526422.6-137666143168273 && echo
> $HOME/.ansible/tmp/ansible-tmp-1455526422.6-137666143168273']
> 08:53:42 <localhost> REMOTE_MODULE wait_for timeout=300 port=22 host=MYIP.166
> search_regex=OpenSSH
> 08:53:42 <localhost> EXEC ['/bin/sh', '-c', 'mkdir -p
> $HOME/.ansible/tmp/ansible-tmp-1455526422.61-251158851714980 && chmod a+rx
> $HOME/.ansible/tmp/ansible-tmp-1455526422.61-251158851714980 && echo
> $HOME/.ansible/tmp/ansible-tmp-1455526422.61-251158851714980']
> 08:53:42 <localhost> PUT /tmp/tmpRGLwen TO
> /home/rhos-ci/.ansible/tmp/ansible-tmp-1455526422.6-137666143168273/wait_for
> 08:53:42 <localhost> EXEC ['/bin/sh', '-c', u'LANG=en_US.UTF-8
> LC_CTYPE=en_US.UTF-8 /usr/bin/python
> /home/rhos-ci/.ansible/tmp/ansible-tmp-1455526422.6-137666143168273/wait_for;
> rm -rf /home/rhos-ci/.ansible/tmp/ansible-tmp-1455526422.6-137666143168273/
> >/dev/null 2>&1']
> 08:53:42 <localhost> PUT /tmp/tmpQ65KDK TO
> /home/rhos-ci/.ansible/tmp/ansible-tmp-1455526422.61-251158851714980/wait_for
> 08:53:42 <localhost> EXEC ['/bin/sh', '-c', u'LANG=en_US.UTF-8
> LC_CTYPE=en_US.UTF-8 /usr/bin/python
> /home/rhos-ci/.ansible/tmp/ansible-tmp-1455526422.61-251158851714980/wait_for;
> rm -rf /home/rhos-ci/.ansible/tmp/ansible-tmp-1455526422.61-251158851714980/
> >/dev/null 2>&1']
> 08:53:42 ok: [r4mjw-rhos-ci-1120-rh-pud-pksk-controller -> localhost] =>
> {"changed": false, "elapsed": 0, "path": null, "port": 22, "search_regex":
> "OpenSSH", "state": "started"}
> 08:53:42 ok: [r4mjw-rhos-ci-1120-rh-pud-pksk-tester -> localhost] =>
> {"changed": false, "elapsed": 0, "path": null, "port": 22, "search_regex":
> "OpenSSH", "state": "started"}
>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/7c65eab7-1131-414b-9ca0-69c2c7127e53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.