bcoca answered about why the wait_for is taking so much CPU but
there's another part of your question as well -- why it's taking so
long.

If you don't specify a port or a path then ansible is just waiting for
a set amount of time before it goes to the next task.  The default
value of timeout is 300 so should be about 5 minutes.  Since you are
checking a host that's in your inventory you probably want to check
for the ssh port becoming active instead.  Something like this:

    - name: Wait for the host to accept ssh connections
      wait_for:
        host: "{{ inventory_hostname }}"
        port: 22
        delay: 20
        timeout: 300
        state: started

That will wait until port 22 is available on inventory_hostname or the
timeout of 300s (plus the delay of 20s before the first check is
performed) has expired.

-Toshio

On Tue, May 26, 2015 at 3:10 AM, Florent B <[email protected]> wrote:
> Hi everyone,
>
> I use Ansible 1.9.1 on an Ubuntu 15.04 deploy host.
>
> I manage some Debian hosts.
>
> When I use this command to wait for an host after reboot :
>
> local_action: wait_for host={{ inventory_hostname }} state=started delay=20
> sudo: false
>
> It creates a python process on my deploy host, which is taking 100% of
> my CPU (of a core, of course).
>
> The command works, but it detects that a host is back after a very long
> delay after it really comes back (host comes back at T0, and Ansible
> detects it up at T0+2 minutes for example).
>
> Am I doing something wrong ?
>
> Is it a bug ?
>
> Thank you
>
> --
> 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/5564468F.7060006%40coppint.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CAG9juEoqKKfKDqUhKcVQRJVqaZpavoczN_ABQ9OdG7KgcYTxmQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to