# wait for isn't waiting

**URL:** <https://forum.ansible.com/t/wait-for-isnt-waiting/18066>\
**Category:** Ansible Project\
**Created:** [April 23, 2015, 7:24pm UTC](https://forum.ansible.com/t/wait-for-isnt-waiting/18066 "2015-04-23T19:24:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Short](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@Chris\_Short](https://forum.ansible.com/u/Chris_Short)\
**Post date:** [April 23, 2015, 7:24pm UTC](https://forum.ansible.com/t/wait-for-isnt-waiting/18066/1 "2015-04-23T19:24:50Z")

</div>

For some reason this wait for is not working:

- name: stop  
shell: /opt/tools/shutdown.sh  
wait\_for  
port=8009  
state=stopped  
delay=15  
timeout=300

When running this in a playbook the playbook finishes immediately. I cannot for the life of me figure out why as port 8009 is open for a significant amount of time after the shell is executed.

---

<div class="post-metadata">

**Author:** ![Yassen\_Damyanov](https://avatars.discourse-cdn.com/v4/letter/y/9fc29f/32.png) [@Yassen\_Damyanov](https://forum.ansible.com/u/Yassen_Damyanov)\
**Post date:** [April 23, 2015, 7:56pm UTC](https://forum.ansible.com/t/wait-for-isnt-waiting/18066/2 "2015-04-23T19:56:11Z")

</div>

Just a hint: the default host for the “port” version of “wait\_for” is 127.0.0.1. If your service is bound to another interface (say, 192.168.5.5), then wait\_for will not wait.  
Y.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [April 23, 2015, 8:00pm UTC](https://forum.ansible.com/t/wait-for-isnt-waiting/18066/3 "2015-04-23T20:00:11Z")

</div>

wait\_for is a task, not a property of shell, it needs it's own task  
block, also you might want to make it a 'local action' if that port is  
related in any way to how you access that host.
