Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
with the next structure:
- vmHash: { vcpu: 1,
ram: 1024,
storage: 10,
vms: [{name: storage1-dev02,ip: 10.199.3.87},
{name: storage2-dev02,ip: 10.199.3.88},
{name: storage3-dev02,ip: 10.199.3.89}]
}
and the next debug:
- debug: msg="{{ vmHash.vms }}"
- debug: msg="{{ vmHash.vms.ip }}"
output:
TASK: [vc.storage | debug msg="[{'ip': '10.199.3.87', 'name': 'storage1-dev02'}, {'ip': '10.199.3.88', 'name': 'storage2-dev02'}, {'ip': '10.199.3.89', 'name': 'storage3-dev02'}]"] ***
ok: [s04.lab] => {
"item": "",
"msg": "[{'ip': '10.199.3.87', 'name': 'storage1-dev02'}, {'ip': '10.199.3.88', 'name': 'storage2-dev02'}, {'ip': '10.199.3.89', 'name': 'storage3-dev02'}]"
}
TASK: [vc.storage | debug msg="{{vmHash.vms.ip}}"] ****************************
fatal: [s04.lab] => One or more undefined variables: 'list object' has no attribute 'ip'
FATAL: all hosts have already failed -- aborting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment