# It is possible to delay "delegate\_to" until remote server is ready?

**URL:** <https://forum.ansible.com/t/it-is-possible-to-delay-delegate-to-until-remote-server-is-ready/14797>\
**Category:** Ansible Project\
**Created:** [March 17, 2014, 11:19pm UTC](https://forum.ansible.com/t/it-is-possible-to-delay-delegate-to-until-remote-server-is-ready/14797 "2014-03-17T23:19:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juergen\_Brendel](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@Juergen\_Brendel](https://forum.ansible.com/u/Juergen_Brendel)\
**Post date:** [March 17, 2014, 11:19pm UTC](https://forum.ansible.com/t/it-is-possible-to-delay-delegate-to-until-remote-server-is-ready/14797/1 "2014-03-17T23:19:28Z")

</div>

Hello!

I have a site.yml file, which includes a ‘frontend.yml’ and a ‘backend.yml’ playbook to configure app servers and database servers. The frontend.yml playbook is applied to the hosts in the “frontend” group, while the backend.yml file applies to the hosts in the “backend” group.

Is there a way to ensure that the step specified in ‘delegate\_to’ is only run on the remote host (the database host), once the remote host is in a certain state or has finished the setup of a specific step?

Thank you very much!

---

<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:** [March 21, 2014, 12:11pm UTC](https://forum.ansible.com/t/it-is-possible-to-delay-delegate-to-until-remote-server-is-ready/14797/2 "2014-03-21T12:11:39Z")

</div>

Maybe it would be easier instead to have the ‘access-config’ file be a template and have a template task that runs on the database server.

You can see info on accessing data about other hosts at [http://docs.ansible.com/playbooks\_variables.html#magic-variables-and-how-to-access-information-about-other-hosts](http://docs.ansible.com/playbooks_variables.html#magic-variables-and-how-to-access-information-about-other-hosts)

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [March 21, 2014, 1:30pm UTC](https://forum.ansible.com/t/it-is-possible-to-delay-delegate-to-until-remote-server-is-ready/14797/3 "2014-03-21T13:30:35Z")

</div>

You can look up “wait\_for” for basic port open-ness or use a “until” loop in Ansible, so plenty of options if you want to wait until something gets into a particular state.

[http://docs.ansible.com/wait\_for\_module.html](http://docs.ansible.com/wait_for_module.html)

[http://docs.ansible.com/playbooks\_loops.html#do-until-loops](http://docs.ansible.com/playbooks_loops.html#do-until-loops)
