Hi,
Thanks, I think I was too tired to see that stupid mistake.
Thanks a lot !
Le lundi 9 novembre 2015 22:50:24 UTC+1, Matt Martz a écrit :
>
> You should not nest jinja2 print statements. Instead you can just use raw
> vars once you are inside of {{ }}
>
> Such as:
>
> {{ nm_java_apps_params[my_var]['dest_folder'] }}
>
> On Mon, Nov 9, 2015 at 3:29 PM, Pierre Mavro <[email protected]
> <javascript:>> wrote:
>
>> Hi,
>>
>> I've got a dictionary which looks like this:
>>
>> "var": {
>> "nm_java_apps_params": {
>> "nm-core": {
>> "dest_folder": '/tmp/test'
>> "port": 9487,
>> "start_options": " -Xmx16G -XX:+UseG1GC
>> -XX:+UseStringDeduplication",
>> "version": "latest"
>> },
>> "nm-staticmaps": {
>> "dest_folder": '/tmp/test'
>> "port": 9462,
>> "start_options": "",
>> "war_name": "latest.war"
>> }
>> }
>> }
>>
>> In a role, I can access data like this:
>>
>> {{ nm_java_apps_params['{{my_var}}']['dest_folder'] }}
>>
>>
>> However, when I'm trying in Jinja with the same way, I've got:
>>
>> {'msg': "AnsibleUndefinedVariable: One or more undefined variables:
>> 'dict object' has no attribute '{{my_var}}'", 'failed': True}
>>
>> Any idea of what I missed here ?
>>
>> Thanks in advance
>>
>> --
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/b75377f2-56d5-4e5e-8152-940c673760bc%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/ansible-project/b75377f2-56d5-4e5e-8152-940c673760bc%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Matt Martz
> @sivel
> sivel.net
>
--
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/78ac06cc-e7ff-4b35-b05a-3980ba9be31a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.