I have prepared a YAML file which arrange some constant values as
dictionary of dictionaries:
*values:*
* key1:*
* val1: 1.1*
* val2:*
* - 1.2.1*
* - 1.2.2*
* val3:*
* - 1.3.1*
* - 1.3.2*
* val4:*
* - 1.4.1*
* - 1.4.2*
* key2:*
* val1: 2.1*
* val2:*
* - 2.2.1*
* val3:*
* - 2.3.1*
* val4:*
* - 2.4.1*
The values for first level of keys (key1,key2) will be provided to the
playbook as variable 'key' and i am trying to use the dictionary values
corresponding to the dictionary i get from this 'key'. But i am unable to
reference this dict within the playbook. I have tried some of these ways:
- debug: msg="value - {{values.{{key}}}.val1}"
- debug: msg="value - {{values[{{key}}]}}"
- debug: msg="value - {{values[{{key}}][val1]}}"
But nothing works. How can i refer to some keys in a dictionary via
variables ?
And also, can someone guide me to a good resource which can educate me with
the advanced syntax and usage of both YAML and Jinja2 ? I am sick of this
hit and trial but couldn't find a detailed resource either.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/ddfc272d-cf03-42eb-b564-6bf5e322dc72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.