# wait\_for URL to response 200 status code

**URL:** <https://forum.ansible.com/t/wait-for-url-to-response-200-status-code/17535>\
**Category:** Ansible Project\
**Created:** [February 17, 2015, 5:01pm UTC](https://forum.ansible.com/t/wait-for-url-to-response-200-status-code/17535 "2015-02-17T17:01:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pradeep\_Bhadani](https://avatars.discourse-cdn.com/v4/letter/p/df788c/32.png) [@Pradeep\_Bhadani](https://forum.ansible.com/u/Pradeep_Bhadani)\
**Post date:** [February 17, 2015, 5:01pm UTC](https://forum.ansible.com/t/wait-for-url-to-response-200-status-code/17535/1 "2015-02-17T17:01:32Z")

</div>

Hi ,

I want to pause my playbook until one url returns 200 as status code.  
URL may take several minutes to return 200 .  
I am not sure what is the best way to achieve this.  
can anyone guide me?

Thanks,  
Pradeep

---

<div class="post-metadata">

**Author:** ![Mirko\_Friedenhagen](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@Mirko\_Friedenhagen](https://forum.ansible.com/u/Mirko_Friedenhagen)\
**Post date:** [February 17, 2015, 10:11pm UTC](https://forum.ansible.com/t/wait-for-url-to-response-200-status-code/17535/2 "2015-02-17T22:11:01Z")

</div>

Hello Pradeep,

See [https://github.com/mfriedenhagen/huschteguzzel-fabric/blob/master/roles/jenkins/tasks/start\_jenkins.yml](https://github.com/mfriedenhagen/huschteguzzel-fabric/blob/master/roles/jenkins/tasks/start_jenkins.yml) for an example using curl. Depending on your usecase you should probably make this a local\_action.

Regards  
Mirko

---

<div class="post-metadata">

**Author:** ![Giovanni\_Tirloni](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Giovanni\_Tirloni](https://forum.ansible.com/u/Giovanni_Tirloni)\
**Post date:** [February 17, 2015, 11:10pm UTC](https://forum.ansible.com/t/wait-for-url-to-response-200-status-code/17535/3 "2015-02-17T23:10:31Z")

</div>

Thanks for sharing!

Perhaps the uri module might be a target of some improvements in this  
area. It seems if it had a http\_timeout and retries, this use case could  
be handled without curl. The same goes for wait\_for and retries. Would  
it make sense or is it better done some other way?

Giovanni

---

<div class="post-metadata">

**Author:** ![Mirko\_Friedenhagen](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@Mirko\_Friedenhagen](https://forum.ansible.com/u/Mirko_Friedenhagen)\
**Post date:** [February 18, 2015, 6:49am UTC](https://forum.ansible.com/t/wait-for-url-to-response-200-status-code/17535/4 "2015-02-18T06:49:14Z")

</div>

It’s a little bit tricky, as you see I only do a HEAD request here. Internally we have a lot of systems which use authorizations but not basic auth, some need preemptive authorization. To include all this in get\_url would be a major task IMO.

Regards  
Mirko
