I have below registered variable output. And I am trying to get the unique tagId
s from this output.
Ansible Version: 2.9.6
"results": [
{
"json": [
{
"tags": [
{
"tagId": 123
},
{
"tagId": 1014
}
]
}
]
},
{
"json": [
{
"adp_release": "xxxxxx",
"tags": [
{
"tagId": 111
},
{
"tagId": 1014
}
]
}
]
}
]
Trying with the below code:
This is only retuning the last element tags from the results
list. Incremental update for loop in set_fact not working.
- name: get all tags
set_fact: alltags={{ item.json[0]['tags'] | map(attribute='tagId') | list |unique }}
with_items: "{{ results }}"
- debug: var=alltags
How to get a combined list of values?