# wait\_for host : 100% CPU on deploy host

**URL:** <https://forum.ansible.com/t/wait-for-host-100-cpu-on-deploy-host/18310>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [May 26, 2015, 2:19pm UTC](https://forum.ansible.com/t/wait-for-host-100-cpu-on-deploy-host/18310 "2015-05-26T14:19:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [May 26, 2015, 2:19pm UTC](https://forum.ansible.com/t/wait-for-host-100-cpu-on-deploy-host/18310/1 "2015-05-26T14:19:33Z")

</div>

bcoca answered about why the wait\_for is taking so much CPU but  
there's another part of your question as well -- why it's taking so  
long.

If you don't specify a port or a path then ansible is just waiting for  
a set amount of time before it goes to the next task. The default  
value of timeout is 300 so should be about 5 minutes. Since you are  
checking a host that's in your inventory you probably want to check  
for the ssh port becoming active instead. Something like this:

&nbsp;&nbsp;&nbsp;&nbsp;- name: Wait for the host to accept ssh connections  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wait\_for:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;host: "{{ inventory\_hostname }}"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;port: 22  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delay: 20  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;timeout: 300  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;state: started

That will wait until port 22 is available on inventory\_hostname or the  
timeout of 300s (plus the delay of 20s before the first check is  
performed) has expired.

-Toshio

---

<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:** [May 26, 2015, 2:20pm UTC](https://forum.ansible.com/t/wait-for-host-100-cpu-on-deploy-host/18310/2 "2015-05-26T14:20:35Z")

</div>

you might also want to make it a local\_action
