I'm trying to assign a variable to match IP address shown in API call I'm making to an online service provider.
Here is the JSON data I'm receiving:
TASK [manager : debug] *********************************************************
ok: [localhost] => {
"msg": [
{
"address": "10.0.3.224",
"family": "inet",
"netmask": "24",
"scope": "global"
},
{
"address": "fe80::216:3eff:feb2:7330",
"family": "inet6",
"netmask": "64",
"scope": "link"
}
]
}
How can I go about parsing the first address output and assign its value to a variable in YAML
this is what I have tried
- debug: msg={{ output.stdout|from_json }}
but I'm unable to get the IP address.
Try: msg={{ (output.stdout | from_json | first).address }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With