- local_action: wait_for host={{inventory_hostname}} port=22
However, some of my managed servers are not directly reachable from my laptop, so I usually connect to them via a bastion host. This means that the port 22 test will fail for them.
I thought about using the ping module instead, which should just do an SSH ping to a host. However, the ping module times out after a while when the underlying ssh connection times out, so I can't make it wait long enough for the server to finish rebooting.
Does anyone have any ideas or suggestions on how to work around this?
Anand
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You could consider running Ansible from the bastion host, versus using an SSH jumphost which I infer you are using above.
The ping module doesn't ICMP ping, BTW, it's a basic Ansible connectivity test.
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I am running into a similar situation and have been thinking about using the shell: ping approach too. But what I came up in the following didn't seem to do the trick. Would appreciate a hint:
---
- name: ping a remote host many times
local_action: shell ping -v {{ inventory_hostname }}
register: result
until: result.stdout.rc == '0'
retries: 5
delay: 5
I can also confirm that the typical approach using wait_for as published, e.g. by ansible support, works only with one-hop, anytime ssh jump-host (more than one hop) is used, the approach fails.
--Zack
Quick correction and follow-up:
I should have been more careful when cut-n-paste.
The task include file should be
---
- name: ping a remote host many times
local_action: shell ping -v {{ inventory_hostname }}
register: result
until: result.rc == '0'
retries: 5
delay: 5
Note on the until: line, I should have been written it as result.rc =='0'. When I said it didn't work, I meant that at the end of my test, I saw:
msg: Task failed as maximum retries was encountered
FATAL: all hosts have already failed -- aborting
That's just as ugly :( I don't have an idea how to make a "normal" play termination yet. Any hints appreciated.
-- Zack
I am running into a similar situation and have been thinking about using the shell: ping approach too. But what I came up in the following didn't seem to do the trick. Would appreciate a hint:
---
- name: ping a remote host many times
local_action: shell ping -v {{ inventory_hostname }}
register: result
until: result.stdout.rc == '0'
retries: 5
delay: 5I can also confirm that the typical approach using wait_for as published, e.g. by ansible support, works only with one-hop, anytime ssh jump-host (more than one hop) is used, the approach fails.
--Zack
[...]