Thanks Matt! is there way to do this in a playbook. The first one works the 
second one doesn't.

  - debug: msg="hey {{ item }}"
    with_items: groups['tag_env_prod']

  - debug: msg="hey {{ item }}"
    with_items: groups['{{group_name}}']

On Thursday, November 12, 2015 at 7:59:20 AM UTC-5, Matt Martz wrote:
>
> You can't nest jinja2 delimiters.  You just use bare variable names inside 
> such 
> as:
>
> {% for host in groups[VAR] %}
>
> On Thursday, November 12, 2015, Edgardo Vega <[email protected] 
> <javascript:>> wrote:
>
>> I am trying to do the following where I index groups by a variable 
>> instead of hardcoding it. Is that possible somehow?
>>
>> {% for host in groups['{{VAR}}'] %}
>>  STUFF
>> {% endfor %}
>>
>>
>> Thanks in advance,
>>
>> Edgardo
>>
>>
>> -- 
>> 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/1d72aea3-f95f-45dc-99c5-f60f07fb51a0%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/1d72aea3-f95f-45dc-99c5-f60f07fb51a0%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>
>

-- 
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/c970b09c-cb50-4cad-b9cc-44161b152009%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to