Im using ansible 2.9.2 and i have this playbook :
register: output
- debug: msg={{ output.instance }}
which gives this output:
TASK [debug] ***************************************************************************************************************************************************************
ok: [localhost] => {
"msg": {
"annotation": "",
"current_snapshot": null,
"customvalues": {},
"guest_consolidation_needed": false,
"guest_question": null,
"guest_tools_version": "0",
"hw_cluster": null,
"hw_datastores": [
"V1",
],
"hw_esxi_host": "10.10.101.10",
"hw_eth0": {
"addresstype": "assigned",
"ipaddresses": null,
"label": "",
"macaddress": "00:00:00:00:00:51",
"portgroup_key": null,
"portgroup_portkey": null,
"summary": "Vlan1"
How can i get the output to give me onlythe "ipaddresses": null
?
I tried this :
- debug: msg={{ output.instance | json_query('hw_eth0{}.ipaddresses') }}
but got an error
FAILED! => {"msg": "JMESPathError in json_query filter plugin:\\ninvalid token: Parse error at column 7, token \\"{\\" (LBRACE), for expression:\\n\\"hw_eth0{}.ipaddresses