It was a typo error from my side. The solution is working fine. Thx a lot
Den onsdag den 19. februar 2014 20.48.23 UTC+1 skrev Khuong Dinh Pham:
>
> Hi
>
> I have added my vars via include_vars and not in hostvars
>
> - include_vars: /path/myvars.yml
> - template: src=input.j2 dest=output.j2
>
> so {{ hostvars[inventory_hostname][ "my_" + env + "_port"] }} will
> not working
>
> What will the name of the array then be?
>
>
> Den onsdag den 19. februar 2014 17.11.17 UTC+1 skrev Serge van
> Ginderachter:
>>
>>
>> On 19 February 2014 15:03, Khuong Dinh Pham <[email protected]> wrote:
>>
>>> Vars:
>>> environements: ["trunk", "dev01"]
>>> my_trunk_port: 8080
>>> my_dev01_port: 8180
>>>
>>> Template:
>>> {{ my_{{ env }}_port }}
>>>
>>
>> try something like this:
>>
>> {{ hostvars[inventory_hostname][ "my_" + env + "_port"] }}
>>
>>
>> if I'm not mistaken..
>>
>>
--
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].
For more options, visit https://groups.google.com/groups/opt_out.