wait_for URL to response 200 status code

3,254 views
Skip to first unread message

Pradeep Bhadani

unread,
Feb 17, 2015, 12:01:32 PM2/17/15
to ansible...@googlegroups.com
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


Mirko Friedenhagen

unread,
Feb 17, 2015, 5:11:06 PM2/17/15
to ansible-project

Hello Pradeep,

See 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
--
Sent from my mobile

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7bf2cc1c-5769-4d60-8a46-5de5ca304194%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Giovanni Tirloni

unread,
Feb 17, 2015, 6:10:39 PM2/17/15
to ansible...@googlegroups.com
On Tue, 17 Feb 2015 23:11 +0100, Mirko Friedenhagen
<mfried...@gmail.com> wrote:
> Hello Pradeep,
>
> See
> 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.

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

Mirko Friedenhagen

unread,
Feb 18, 2015, 1:49:21 AM2/18/15
to ansible-project

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
--
Sent from my mobile

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages