convert ansible list of dictionariest to a list by value (in ansbile task)

is there any way to convert list of dicts to list with values from one key from all dicts? (in ansible task) input:

[{'a':1, 'b': it}, {'a':2, 'b': ti}]

output

[1,2]

Ответы (1 шт):

Автор решения: SimonZen

Это можно сделать с помощью json_query

debug: msg="{{ mydict | jsonquery(myquery) }}"
vars:
 myquery: "[*].needed_key"
→ Ссылка