wait_for ping?

445 views
Skip to first unread message

Heinz Meier

unread,
Feb 23, 2020, 5:10:32 AM2/23/20
to Ansible Project
Hi,

need to wait until a host is up and running. This host does not (yet) offer ssh, so I need a simple ping. The module wait_for only offers port tests, as far as I can see. Any ideas?

Michael Schwartzkopff

Kai Stian Olstad

unread,
Feb 23, 2020, 5:28:45 AM2/23/20
to ansible...@googlegroups.com
On Sun, Feb 23, 2020 at 02:10:32AM -0800, Heinz Meier wrote:
> need to wait until a host is up and running. This host does not (yet) offer
> ssh, so I need a simple ping. The module wait_for only offers port tests,
> as far as I can see. Any ideas?

You can use the until on a task

- command: ping -c1 <host>
register: r
until: r.rc == 0

You can also change retries and delay, check the documentation for details.

--
Kai Stian Olstad

Heinz Meier

unread,
Feb 23, 2020, 6:24:15 AM2/23/20
to Ansible Project
Thanks. cool

Jordan Borean

unread,
Feb 23, 2020, 1:54:19 PM2/23/20
to Ansible Project
wait_for_connection is designed to wait until ssh is up and running and Ansible can actually run a module on it. No need for any until loops just ‘wait_for_connection:’.
Reply all
Reply to author
Forward
0 new messages