Hi all,
I’d like to extract from a yaml complex dictionary as
node:
host1:
- { id: ‘1’ }
- { id: ‘2’ }
all values for ‘id’ for ‘host1’
in order to convert this snipped of code from
id_list: {{ xxx }}
in
id_list: ‘1’ ‘2’
in python I can do the following
node= {‘test1’:[{‘id’:‘1’},{‘id’:‘2’}]}
node
{‘test1’: [{‘id’: ‘1’}, {‘id’: ‘2’}]}
" “.join([”‘%s’"% x[‘id’] for x in node[‘test1’]]) #this is xxx
“‘1’ ‘2’”
but in ansible how can obtain the same?