New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2.0] wait_for fails with timeout #14237
Comments
This is working as expected: That it is hitting the default timeout (300) indicates that the test1 host was not up in that time, increase the timeout if it is just taking the host longer to boot and get ssh up and running. Closing this as it is not a bug, please post to IRC or the mailing lists first as you can probably get help much faster:
|
Guess my description was really poor.. The issue is, host is up and accessible long before timeout ends, every time I've run this test. Here is timeout error on version 1.9.4, when host is indeed not accessible:
And here is error message from example above: |
can you use debug on |
Run more tests with following playbook:
First result was the same:
But then I've looked at inventory, and yes it was set to use deprecated variable :( changed it to new variable
Looks like variable Then I've run slightly more complicated playbook:
with inventory without Got error again:
So |
this really works for me. ansible: 2.1.1.0 |
If you use same variable name (ansible_ssh_host or ansible_host) in both inventory and module then it is working fine or else wait_for will take it as localhost. I tested with both ansible 2.1.1.0 and 2.1.0.0. |
I set the exact host IP / hostname to wait_for task to avoid confusion. My snippet below. Hope it helps someone
|
The tricky part here is that inside a - set_fact:
real_ansible_host: "{{ ansible_host }}"
- name: restart hosts
shell: sleep 3 && shutdown -r now
async: 1
poll: 0
ignore_errors: true
- name: wait for hosts to go down
local_action:
wait_for host={{ real_ansible_host }}
port=22 state=absent delay=1 timeout=120
become: false
- name: wait for hosts to come back up
local_action:
wait_for host={{ real_ansible_host }}
port=22 state=started delay=30 timeout=120
become: false |
Looks like #21269 was filed for the above issue. |
I'm getting this issue too on EC2 |
Playbook (wait_for task example straight from documentation):
result:
looks like 'wait_for' is checking localhost instead of remote host.
Removed 'local_action' from task, fails immediately with:
The text was updated successfully, but these errors were encountered: