change result to vm_state if youre using vsphere_guest
register: vm_state
until: vm_state.ansible_facts.hw_power_status == 'POWERED OFF'
retries: 10
delay: 5
On Wednesday, April 4, 2018 at 9:34:32 AM UTC-4, Zeljko Dokman wrote:
>
> Hi, I am trying to use this code to check VM power state and its failing
> for me with this error..
>
> "msg": "The conditional check 'result.hw_power_status == \"POWERED OFF\"'
> failed. The error was: error while evaluating conditional
> (result.hw_power_status == \"POWERED OFF\"): 'dict object' has no attribute
> 'hw_power_status'"
>
> My playbook..
> Enter code here... - name: Wait till {{ target }} is powered off
> vsphere_guest:
> vcenter_hostname="{{ vcenter_server }}"
> [email protected]
> password="{{ vc_passwd }}"
> guest=mbu-zabbix-ccp
> validate_certs=False
> vmware_guest_facts=yes
> register: result
> until: result.hw_power_status == "POWERED OFF"
> retries: 10
> delay: 5
>
> i tried with
> result.hw_power_status == "POWERED OFF"
> and
> result.ansible_facts.hw_power_status == "POWERED OFF"
>
> both fail with a same error..
>
> Regards
>
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/2153a541-6435-4a3c-a40c-0be0ec42b137%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.