# version 0.9: wait\_for suck in wait until timeout, it cannot wake up after the host can be accessed by ssh

**URL:** <https://forum.ansible.com/t/version-0-9-wait-for-suck-in-wait-until-timeout-it-cannot-wake-up-after-the-host-can-be-accessed-by-ssh/17625>\
**Category:** Ansible Project\
**Created:** [February 26, 2015, 8:32am UTC](https://forum.ansible.com/t/version-0-9-wait-for-suck-in-wait-until-timeout-it-cannot-wake-up-after-the-host-can-be-accessed-by-ssh/17625 "2015-02-26T08:32:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hce](https://avatars.discourse-cdn.com/v4/letter/h/c0e974/32.png) [@hce](https://forum.ansible.com/u/hce)\
**Post date:** [February 26, 2015, 8:32am UTC](https://forum.ansible.com/t/version-0-9-wait-for-suck-in-wait-until-timeout-it-cannot-wake-up-after-the-host-can-be-accessed-by-ssh/17625/1 "2015-02-26T08:32:46Z")

</div>

Hi,

I have following wait\_for statement after reboot the host, but it stuck in the wait until the timeout even the host can be accessed manually when I run ssh the host. Is it a bug or what I could be missing?

- name: Wait for restart  
local\_action: wait\_for host=“{{ inventory\_hostname }}” port=22 delay=5 timeout=3600 state=started

Thank you.

- j

---

<div class="post-metadata">

**Author:** ![hce](https://avatars.discourse-cdn.com/v4/letter/h/c0e974/32.png) [@hce](https://forum.ansible.com/u/hce)\
**Post date:** [February 26, 2015, 8:34am UTC](https://forum.ansible.com/t/version-0-9-wait-for-suck-in-wait-until-timeout-it-cannot-wake-up-after-the-host-can-be-accessed-by-ssh/17625/2 "2015-02-26T08:34:22Z")

</div>

Sorry, the version is 1.9.

---

<div class="post-metadata">

**Author:** ![Yariv\_Graf](https://avatars.discourse-cdn.com/v4/letter/y/5e9695/32.png) [@Yariv\_Graf](https://forum.ansible.com/u/Yariv_Graf)\
**Post date:** [February 26, 2015, 11:41am UTC](https://forum.ansible.com/t/version-0-9-wait-for-suck-in-wait-until-timeout-it-cannot-wake-up-after-the-host-can-be-accessed-by-ssh/17625/3 "2015-02-26T11:41:30Z")

</div>

Hi,  
Try:

- name: wait for SSH  
local\_action: wait\_for port=22 host=“{{ inventory\_hostname }}” search\_regex=OpenSSH delay=30  
sudo: false  
It will start to search for the regex after 30 secs.

---

<div class="post-metadata">

**Author:** ![vaida.dan](https://avatars.discourse-cdn.com/v4/letter/v/5daacb/32.png) [@vaida.dan](https://forum.ansible.com/u/vaida.dan)\
**Post date:** [February 26, 2015, 4:58pm UTC](https://forum.ansible.com/t/version-0-9-wait-for-suck-in-wait-until-timeout-it-cannot-wake-up-after-the-host-can-be-accessed-by-ssh/17625/4 "2015-02-26T16:58:38Z")

</div>

Unless there’s some other problem in the mix, this is enough to work:

`  
local\_action: wait\_for state=started host=“{{ inventory\_hostname }}” port=22

`

---

<div class="post-metadata">

**Author:** ![hce](https://avatars.discourse-cdn.com/v4/letter/h/c0e974/32.png) [@hce](https://forum.ansible.com/u/hce)\
**Post date:** [February 27, 2015, 8:56am UTC](https://forum.ansible.com/t/version-0-9-wait-for-suck-in-wait-until-timeout-it-cannot-wake-up-after-the-host-can-be-accessed-by-ssh/17625/5 "2015-02-27T08:56:12Z")

</div>

Thanks Yariv and Dan, but non of your suggestions work, the wait\_for does seem able to detect the host up after reboot. I reckon it is a bug. Anyway, are there any workaround or alternative module to wait reboot?

---

<div class="post-metadata">

**Author:** ![hce](https://avatars.discourse-cdn.com/v4/letter/h/c0e974/32.png) [@hce](https://forum.ansible.com/u/hce)\
**Post date:** [February 27, 2015, 8:57am UTC](https://forum.ansible.com/t/version-0-9-wait-for-suck-in-wait-until-timeout-it-cannot-wake-up-after-the-host-can-be-accessed-by-ssh/17625/6 "2015-02-27T08:57:41Z")

</div>

sorry, it does not seem able to detect the host back after the reboot, any workaround or alternative module to wait reboot?

---

<div class="post-metadata">

**Author:** ![vaida.dan](https://avatars.discourse-cdn.com/v4/letter/v/5daacb/32.png) [@vaida.dan](https://forum.ansible.com/u/vaida.dan)\
**Post date:** [February 27, 2015, 9:29am UTC](https://forum.ansible.com/t/version-0-9-wait-for-suck-in-wait-until-timeout-it-cannot-wake-up-after-the-host-can-be-accessed-by-ssh/17625/7 "2015-02-27T09:29:58Z")

</div>

Can you post the output when running with -vvvv?

---

<div class="post-metadata">

**Author:** ![Brenda\_Bell](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@Brenda\_Bell](https://forum.ansible.com/u/Brenda_Bell)\
**Post date:** [April 17, 2015, 3:21pm UTC](https://forum.ansible.com/t/version-0-9-wait-for-suck-in-wait-until-timeout-it-cannot-wake-up-after-the-host-can-be-accessed-by-ssh/17625/8 "2015-04-17T15:21:44Z")

</div>

I’m having this same issue on 1.8.2. We have plans to upgrade to 1.9, but we’re not there yet and from reading this thread it sounds like that’s not going to fix my issue.

The details… I’m spinning up EC2 instances in a VPC. I have hosts in the private subnet that _are_ accessible through a Bastion host. ssh from the command line responds immediately without errors. ansible/ssh configs are set up correctly (all other playbooks are working as they should against these hosts in the private subnet.

My play looks like this:

`

# NOTE: This may fail because there’s a bug where ansible does not accurately determine

# For this reason, we’re making an educated guess that 360 seconds is long enough and

# ignore any errors from this step

- name: Wait for SSH to come up  
local\_action: wait\_for host={{inventory\_hostname}} port=22 delay=30 timeout=360 state=started  
when: ((‘tag\_type\_mgmt’ in group\_names) or (‘tag\_type\_data’ in group\_names))  
ignore\_errors: yes

`

The output looks like this:

`  
TASK: [Wait for SSH to come up] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
skipping: [172.98.2.226]  
skipping: [52.4.9.253]  
skipping: [172.98.2.242]  
\<127.0.0.1\> REMOTE\_MODULE wait\_for host=172.98.1.95 port=22 delay=30 timeout=360 state=started  
\<127.0.0.1\> REMOTE\_MODULE wait\_for host=172.98.1.156 port=22 delay=30 timeout=360 state=started  
skipping: [172.98.2.167]  
\<127.0.0.1\> EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1429283315.41-248461052526032 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1429283315.41-248461052526032 && echo $HOME/.ansible/tmp/ansible-tmp-1429283315.41-248461052526032’]  
\<127.0.0.1\> EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1429283315.41-33469490390301 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1429283315.41-33469490390301 && echo $HOME/.ansible/tmp/ansible-tmp-1429283315.41-33469490390301’]  
\<127.0.0.1\> PUT /var/folders/wq/0sb44mp50y78qnmkljp9cn91kw35ch/T/tmpohfvzT TO /Users/bbell/.ansible/tmp/ansible-tmp-1429283315.41-248461052526032/wait\_for  
\<127.0.0.1\> PUT /var/folders/wq/0sb44mp50y78qnmkljp9cn91kw35ch/T/tmpnXveWg TO /Users/bbell/.ansible/tmp/ansible-tmp-1429283315.41-33469490390301/wait\_for  
\<127.0.0.1\> EXEC [‘/bin/sh’, ‘-c’, u’LANG=en\_US.UTF-8 LC\_CTYPE=en\_US.UTF-8 /usr/bin/python /Users/bbell/.ansible/tmp/ansible-tmp-1429283315.41-248461052526032/wait\_for; rm -rf /Users/bbell/.ansible/tmp/ansible-tmp-1429283315.41-248461052526032/ \>/dev/null 2\>&1’]  
\<127.0.0.1\> EXEC [‘/bin/sh’, ‘-c’, u’LANG=en\_US.UTF-8 LC\_CTYPE=en\_US.UTF-8 /usr/bin/python /Users/bbell/.ansible/tmp/ansible-tmp-1429283315.41-33469490390301/wait\_for; rm -rf /Users/bbell/.ansible/tmp/ansible-tmp-1429283315.41-33469490390301/ \>/dev/null 2\>&1’]  
failed: [172.98.1.156 → 127.0.0.1] =\> {“elapsed”: 360, “failed”: true}  
msg: Timeout when waiting for 172.98.1.156:22  
…ignoring  
failed: [172.98.1.95 → 127.0.0.1] =\> {“elapsed”: 360, “failed”: true}  
msg: Timeout when waiting for 172.98.1.95:22  
…ignoring

`

The whole time Ansible is sitting there waiting, I’m able to ssh to both of these servers without any issues… so the wait and/or poll is definitely broken.

Brenda
