I have the following data structure set as a fact at the end of an ansible task. I am trying to extract the SITEID's into a list.
"myoutput": [
{
"ID": "ZG5zLmhvc3QkLm5vbl9ETlNfaG9zdF9yb290LjAuMTUzNzE1MTcwNzgxNC5oZWxsbw",
"extattrs": {
"SITEID": "10"
}
},
{
"ID": "r/ZG5zLmhvc3QkLm5vbl9ETlNfaG9zdF9yb290LjAuMTUzNzE1OTcyMzQzNy5ibGFo0",
"extattrs": {
"SITEID": "16"
}
}
]
I have tried the following but this just gives me back an undefined list.
name: write myoutput SITEID to list
set_fact:
mylist : "{{ host[1].extattrs | map(attribute='SITEID') | list }}"