Hello - i'm trying to figure out how to do this if the data isn't JSON:
json_query(host[?name=='webserver'].ipaddress)
In other words, I want to return an attribute from a list based on a
condition. I'm trying to combine data from multiple lists over a shared
key.
example:
- system1
- host: demo1
ipaddress: 192.168.20.20
- host: demo4
ipaddress: 192.168.20.30
- systemstatus
- system: demo4
status: faulty
- system: web5
status: operational
What I would like returned is a single list:
result:
- host: demo4
ipaddress: 192.168.20.30
status: faulty
Currently I'm just looping through "systemstatus" but I how do you do the
simple json query above to extract the data from "example". Or if it
helps, I am getting data from a 3rd system and I would like to use it to
update the inventory data I have about hosts "I know about". And I keep
coming up short on how to select from an list based on a condition that
isn't the index of the array it's implemented in.
--
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/fd21e68f-48ba-479f-a6bc-503861035e4dn%40googlegroups.com.