I've been using this pattern:

vars:
  environments: [ "trunk", "dev01" ]
  my_ports:
    trunk: 8080
    dev01: 8081

template:
  {{ my_ports[env] }}

-dave


On Wed, Feb 19, 2014 at 8:03 AM, Khuong Dinh Pham <[email protected]>wrote:

> Hi
>
> I want to generate the variable names based on another variable value.
> Something like this:
>
> Vars:
> environements: ["trunk", "dev01"]
> my_trunk_port: 8080
> my_dev01_port: 8180
>
> Template:
> {{ my_{{ env }}_port }}
>
> --
> 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.
>

-- 
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.

Reply via email to