I see a lot of discussion about nested variables in Ansible, but I have not yet been able to find a solution to my problem. So yet again another question about nested variables (pease forgive me if this has been answered before, just point me at the previous discussions).
I want to do define a structure like the following:
STRUCTURE:
list1:
- {var1: val1, var2, val2, var3, val3}
list2:
- {var1: val1, var2, val2, var3, val3}
list3:
- {var1: val1, var2, val2, var3, val3}
Then is a playbook I want to be able to use the value in a variable to select one of the lists:
vars:
list: list1
- debug: msg=“var1={{item.var1}}, var2={{item.var2}}, var3={{item.var3}}”
with_(items,subelements,nested,dict,?) - STRUCTURE
- list
Essentially, I need to have a list of dictionaries, I need to select one of those dictionaries with a key, and then I need to pull the values out of the selected dictionary. What is the best way to do this?
Thanks,
-Mark