There isn't really a current group that the role is running on.

You might be able to use the "group_names" variable, however since a host
can be in multiple groups, that is a list and not singular.  You might
however still might be able to make it work.

Your other option is instead to use "play_hosts" which is an explicit list
of hosts targeted by the play.  That may suit your needs better than trying
to guess the group.

On Wed, Mar 25, 2015 at 8:54 AM, Yariv Graf <[email protected]> wrote:

> Hi,
> I have this code of template for zookeeper role:
>
> {% for host in groups['all'] %}
> server.{{ hostvars[host].zookeeper_id }}={{
> hostvars[host]['ansible_hostname'] }}:2888:3888
> {% endfor %}
>
>
> In this example it applies for all hosts in the inventory file.
> I know you can specify a group like : groups['zookeepers'] but I need to
> apply it on the current group the role runs on.
> Is it possible?
>
> Thanks
>
> --
> 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/0f50779a-7664-4496-b264-228f7b64fb00%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/0f50779a-7664-4496-b264-228f7b64fb00%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/CAD8N0v82DDDgvshGVPqvR59t0TeyqtqLAJd--X3v1YmO_mw2oQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to