Thanks Matt, it works.

On Friday, April 29, 2016 at 1:28:39 PM UTC+2, Matt Martz wrote:
>
> You cannot nest {{ }}, instead you want:
>
> {{ file[version] }}
>
> On Friday, April 29, 2016, serkan <[email protected] <javascript:>> 
> wrote:
>
>> Hi,
>> I'm developing a generic tomcat role, it gets version number as variable;
>> ...
>>
>>   roles:
>>
>>   - { role: tomcat,     version: "8.0.33" }
>>
>>
>> I've mentioned download urls for some major versions at vars.yml
>>
>> ...
>>
>> file:
>>
>>         "8": ".......apache-tomcat-8.0.33.tar.gz"
>>
>>         "7": "......apache-tomcat-7.0.33.tar.gz"
>>
>>
>> I would like to use this dictionary at role main.yml for given version 
>> number;
>>
>>
>> Question is, how can I use external variable as dictionary key in role 
>> task.
>>
>>
>> I tried those;
>>
>>
>> - name: copy tomcat to server
>>
>>   copy: src=files/{{file[{{version}}]}} dest=/tmp/
>>
>>
>> - name: copy tomcat to server
>>
>>   copy: src=files/{{file.version}} dest=/tmp/
>>
>>
>> - name: copy tomcat to server
>>
>>   copy: src=files/{{file}}.{{version}} dest=/tmp/
>>
>>
>> Thank you.
>>
>>
>>
>> -- 
>> 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/e2f44f64-3ed0-4fcc-96a3-9386a4df02fd%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/e2f44f64-3ed0-4fcc-96a3-9386a4df02fd%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/ef2e7722-5e12-4c3f-9ba5-d3c4556afce4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to