Waiting for host name to be resolvable

Hey guys,

I’m writing very simple task - I have a web app that I start and it takes a few minutes before it goes online. I thought it can be done like this:

  • name: Waiting for the new environment to be online
    uri: url=http://SOME_URL/api/heartbeat timeout=900
    async: 900
    poll: 10

But the problem is: SOME_URL is not resolvable instantly, it’s a new DNS record. So task fails with the error “msg: Unable to resolve the host name given.”.
Is there any way to solve this issue?

Thanks!

How is the DNS record created?

How about wait_for?


- wait_for: host=SOME_URL port=80 delay=20 state=started

Edgars

svētdiena, 2015. gada 25. janvāris 02:36:35 UTC+1, Yaroslav Tkachenko rakstīja:

It fits this situation perfectly because wait_for will keep trying to
resolve the DNS name over and over (and not just once when it starts).

Regarding the application itself being up, let me suggest a subsequent
check with get_url module (this one doesn't keep trying to resolve the
hostname many times, so wait_for is really required).

Giovanni