I have following wait_for statement after reboot the host, but it stuck in the wait until the timeout even the host can be accessed manually when I run ssh the host. Is it a bug or what I could be missing?
name: wait for SSH
local_action: wait_for port=22 host=“{{ inventory_hostname }}” search_regex=OpenSSH delay=30
sudo: false
It will start to search for the regex after 30 secs.
Thanks Yariv and Dan, but non of your suggestions work, the wait_for does seem able to detect the host up after reboot. I reckon it is a bug. Anyway, are there any workaround or alternative module to wait reboot?
I’m having this same issue on 1.8.2. We have plans to upgrade to 1.9, but we’re not there yet and from reading this thread it sounds like that’s not going to fix my issue.
The details… I’m spinning up EC2 instances in a VPC. I have hosts in the private subnet that are accessible through a Bastion host. ssh from the command line responds immediately without errors. ansible/ssh configs are set up correctly (all other playbooks are working as they should against these hosts in the private subnet.
My play looks like this:
`
NOTE: This may fail because there’s a bug where ansible does not accurately determine
For this reason, we’re making an educated guess that 360 seconds is long enough and
ignore any errors from this step
name: Wait for SSH to come up
local_action: wait_for host={{inventory_hostname}} port=22 delay=30 timeout=360 state=started
when: ((‘tag_type_mgmt’ in group_names) or (‘tag_type_data’ in group_names))
ignore_errors: yes
The whole time Ansible is sitting there waiting, I’m able to ssh to both of these servers without any issues… so the wait and/or poll is definitely broken.