OK, figured it out finally:

with_items: "{{ groups[project_name + '-masters'] }}"

{% for host in groups[project_name + '-masters'] %}


On Tuesday, January 13, 2015 at 3:28:08 PM UTC, David Goodall wrote:
>
> Hi,
>
> I used to have this:
> with_items: groups['masters']
>
> I have now changed the group name to reflect the project name, which is 
> entered into the "project_name" variable when the playbook is run.
> e.g. if the project is "test", the group will be "test-masters"
>
> In the "with_items:" statement, I would like to be able to replace 
> "masters" with something like {{ project_name }}-masters.
>
> The latest attempt is:
> with_items: groups['"ansible_" + project_name + "-masters"']
>
> I have been trawling this group and have tried various incantations, all 
> to no avail so far.
>
> For bonus points, I also have this in a jinja2 template:
> {% for host in groups['masters'] %}
>  - which will need the same treatment...
>
> Any help appreciated!
> Best regards,
> David
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/206a18ce-c2db-4405-8a53-176cf28ca372%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to