I have a dictionary structure that I'm including in my role execution and I'm trying to set an item in one of the dictionaries based on another value. What happens in the below example would be that the execution will fail when running on "another_host" because it won't have the value called "value2" in the dictionary, Ansible gives the "'dict object' has no attribute" error.
I'm not sure if it's because I'm trying to do something that conflicts with Ansible's design or there's just a much simpler way to accomplish what I'm trying to do.
dict1:
abc:
name: abc
value: something
xyz:
name: xyz
value: "{{ dict2[inventory_hostname].values.value2 | default(blah) }}"
dict2:
some_host:
values:
value1: aaa
value2: bbb
another_host:
values:
value1: aaa