wait_for URL to response 200 status code

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

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

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

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