delegate_to is a tricky one and I've come across a few pitfalls. One thing 
to note is that delegate_to is meant to replace the connection vars for the 
host specified, in this case I would have expected ansible_host to be 
localhost in every instance.

What I would suggest is infinitely easier which is to use the 
wait_for_connection task like so;

- name: wait for connection to come online
  wait_for_connection:
    delay: 30
    timeout: 300
  check_mode: False


The wait_for_connection 
plugin http://docs.ansible.com/ansible/latest/wait_for_connection_module.html 
was adding in Ansible 2.3 and is designed to get Ansible to continue to try 
and connect to the current host and run the ping module and wait until it 
succeeds. It's better than wait_for as it not only checks if the port is 
online but also that Ansible can connect to the host before continuing.

Thanks

Jordan

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/77ab157d-b155-45be-aa7b-c11885f63100%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to