Hi,
I can’t find any easy way how to do something like this:
- set_fact:
“mydict[{{ myvar }}]”: “value”
vars:
myvar: “blabla”
However it does not work, because the variable name is not evaluated. The only way I found to do this is very ugly:
- set_fact:
mydict: “{{ mydict | combine({ myvar: ‘value’ }, recursive=true) }}”
vars:
myvar: “blabla”
That is very ugly and can get out of hand quickly when going into deeper nested dictionaries.
Any ideas how to make it “nicer”?