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/CAL8fbwM9_c2%2BQoi18bcjxmeP0o5rYvGo5-b5LzezvbU1qqzo%3DQ%40mail.gmail.com.

Reply via email to