Thanks the anchors did help

On Sunday, February 7, 2021 at 7:51:52 AM UTC+8 [email protected] wrote:

> This could help you:
>
>
> https://docs.ansible.com/ansible/latest/user_guide/playbooks_advanced_syntax.html#id2
>
>
> On Sat, 6 Feb 2021 at 20:28, Jff Frm <[email protected]> wrote:
>
>> Hi,
>>
>>    On my dictionary I need to use a variable to assign the same value on 
>> multiple keys so that I only need to update it in one place, but 
>> unfortunately results in variable is undefined. I've already read that this 
>> is not possible (forgot the source) is there a way to tell Ansible to do 
>> variable expansion inside dict?
>>
>> Regards
>>
>> Jeff
>>
>> - hosts: localhost
>>   vars:
>>     containers:
>>       container1:
>>         version: "1.1.1"
>>         image: "myimage1:{{version}}"
>>       container2:
>>         version: "2.2.2"
>>         image: "myimage2:{{version}}"
>>   tasks:
>>     - debug:
>>         msg: "{{containers}}"
>>
>> # result is 'version' is undefined
>>
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/118349c9-ddd1-45d7-82e8-b1c9ae711d7an%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/118349c9-ddd1-45d7-82e8-b1c9ae711d7an%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> -- 
> Sent from a mobile device - please excuse the brevity, spelling and 
> punctuation.
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a508cc35-37c6-4b7a-9e57-8ad694f2a33fn%40googlegroups.com.

Reply via email to