# wait\_for\_connection with 2.2 and/or wait\_for with a bastion host?

**URL:** <https://forum.ansible.com/t/wait-for-connection-with-2-2-and-or-wait-for-with-a-bastion-host/24229>\
**Category:** Ansible Project\
**Created:** [April 17, 2017, 7:50pm UTC](https://forum.ansible.com/t/wait-for-connection-with-2-2-and-or-wait-for-with-a-bastion-host/24229 "2017-04-17T19:50:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Artz](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@Michael\_Artz](https://forum.ansible.com/u/Michael_Artz)\
**Post date:** [April 17, 2017, 7:50pm UTC](https://forum.ansible.com/t/wait-for-connection-with-2-2-and-or-wait-for-with-a-bastion-host/24229/1 "2017-04-17T19:50:10Z")

</div>

I’m attempting to reboot a Linux host and wait for it to become available again. I’ve followed the ideas in both the docs ([https://docs.ansible.com/ansible/wait\_for\_module.html](https://docs.ansible.com/ansible/wait_for_module.html)) and [https://github.com/ansible/ansible/issues/14413](https://github.com/ansible/ansible/issues/14413) and it “works”, however my situation is slightly different, as I have a bastion/relay host between me and the remote host (in a private OpenStack cloud). So my wait\_for ends up waiting the entire delay+timeout (15+60 seconds) time (and then succeeding, for some reason), despite the fact that the machine rebooted in \<15 seconds.

For a variety of reasons, I’m stuck using the “official” RPMs out of EPEL, which are currently at Ansible 2.2.1, but I just noticed that there is a “wait\_for\_connection” module in 2.3 that sounds like exactly what I need. Is there any way to emulate this functionality with “wait\_for” given that I’ve got a non-routable node and have to go through a bastion host?

Thanks,  
-Mike

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [April 17, 2017, 8:38pm UTC](https://forum.ansible.com/t/wait-for-connection-with-2-2-and-or-wait-for-with-a-bastion-host/24229/2 "2017-04-17T20:38:02Z")

</div>

Ansible 2.3 is in EPEL testing.

However, to use `wait_for` you should also use `delegate_to` and delegate the execution of the task to the bastion, so that `wait_for` is running from the bastion.
