Perhaps try ansible_host instead of ansible_ssh_host? On Wednesday, August 10, 2016 at 1:27:31 PM UTC+2, Chethan S wrote: > > I am trying to develop a simple playbook (which would later be used in > larger ones) to check if Windows VMs in the inventory are up and running. > > --- > - name: Check if VMs are up and running > hosts: localhost > > > tasks: > - name: Pauses the workflow > pause: minutes=2 > > > - name: Wait for port number 5986 to be available > vars: > - vmname: ['VM-NO1', 'VM-NO2'] > local_action: wait_for host={{ hostvars[item].ansible_ssh_host }} > port=5986 state=started delay=10 timeout=15 connect_timeout=15 > with_items: "{{ vmname }}" > > > I have the pause to provide some time for the VM to boot wherein I have > tried times ranging from 1 to 5 minutes. The VMs come up in less than 3 > minutes, actually. > > I am facing a strange issue w.r.t. wait_for. While the VMs are up and > running as can be seen from the vCenter Console, Ansible reports this > failure - > > fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field 'args' > has an invalid value, which appears to include a variable that is > undefined. The error was: 'dict object' has no attribute > 'ansible_ssh_host'\n\nThe error appears to have been in > '/var/lib/awx/projects/vms/waitcheck.yml': line 10, column 7, but may\nbe > elsewhere in the file depending on the exact syntax problem.\n\nThe > offending line appears to be:\n\n\n - name: Wait for port number 5986 to be > available\n ^ here\n"} > > I have added and removed port=5986 flag in the wait_for section. > Surprisingly, the same *playbook runs and reports a success* when running > for the second time. How can I resolve this? >
-- 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-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/88dbe8a0-aa9f-4833-9968-c1707c9fe8be%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.