On 01.04.2019 20:21, Guillaume D wrote:
> Hello,
>
> I'm blocking on this all the weekend.
>
> I'm trying to build dynamically a variable with "item" for browsing in a
> list.
>
> - debug:
> msg: "{{ item.dev }} "
> loop: "{{ nginx }}"
>
>
> This is working well.
>
> But I need to have the choice of the environment.
>
> I tried this:
>
> - debug:
> msg: "{{ lookup('vars', 'item.' + environnement }} "
> loop: "{{ nginx }}"
Because of the quotes item is a sting not a variable.
Correct syntax is
{{ lookup('vars', item['environnement'] }}
--
Kai Stian Olstad
--
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/b18e6963-fc59-7476-28ee-2d191cbd3b20%40olstad.com.
For more options, visit https://groups.google.com/d/optout.