Thanks. That worked perfectly fine.
On Tuesday, 13 September 2016 19:27:49 UTC+5:30, Josh Smift wrote:
>
> ij> The values for first level of keys (key1,key2) will be provided to the
> ij> playbook as variable 'key' and i am trying to use the dictionary
> values
> ij> corresponding to the dictionary i get from this 'key'. But i am unable
> to
> ij> reference this dict within the playbook. I have tried some of these
> ways:
>
> All of those include a common misunderstanding: The curly braces tell
> Ansible "start (and stop) Jinja parsing", they don't delimit variables.
> Once you're parsing Jinja, you don't need to start again in the middle.
>
> I think you want something like
>
> - debug: msg="value - {{values[key]['val1']}}"
>
> "values" and "key" aren't quoted, becuase they're variables. "val1" is,
> because it's a literal string.
>
> ij> And also, can someone guide me to a good resource which can educate me
> ij> with the advanced syntax and usage of both YAML and Jinja2 ? I am sick
> ij> of this hit and trial but couldn't find a detailed resource either.
>
> Others may have better ideas here, but I often use
> http://docs.ansible.com/ansible/playbooks_filters.html and
> http://jinja.pocoo.org/docs/dev/templates/ for Jinja help.
>
> -Josh ([email protected] <javascript:>)
>
> (apologies for the automatic corporate disclaimer that follows)
>
> This email is intended for the person(s) to whom it is addressed and may
> contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized
> use, distribution, copying, or disclosure by any person other than the
> addressee(s) is strictly prohibited. If you have received this email in
> error, please notify the sender immediately by return email and delete the
> message and any attachments from your system.
>
--
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/7918b67c-69ff-45c4-98aa-2c6fc746005e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.