I would use vars to simplify the tasks themselves, alternatively you
could use a block to establish the common condition
- name: run when not powered off
vmware_guest_powerstate:
hostname: '{{ mdb_console.json.0[resolved_name]}}'
...
vars:
powerstate: '{{ (json_file.stdout | from_json).power_state}}'
console_defined : '{{ mdb_console.json.0['console'] is defined}}'
resolved_name: '{{ console_defined|ternary("console", "vconsole")}}'
when: 'powerstate != "poweredOff"'
--
----------
Brian Coca
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CACVha7d0sg9RH7Wgm-50uc-VYW5u2eTgYoq3UkDbXt-Deb-_1Q%40mail.gmail.com.