ansible json-query path to select item by content ansible json-query path to select item by content json json

ansible json-query path to select item by content


Do you need list of ids? If so, try:

- debug: msg="{{ lookup('file','test.json') | from_json | json_query(query) }}"  vars:    query: "Foods[].{id: Id, for: (Tags[?Key=='For'].Value)[0]} | [?for=='Tigger'].id"

First construct simple objects with necessary fields and then pipe it to a filter.