Hello René,

you can use the group_names and groups variables: 
http://docs.ansible.com/ansible/playbooks_variables.html#magic-variables-and-how-to-access-information-about-other-hosts


Hope this helps,
Dennis Benzinger | SAP Hybris

On Monday, February 15, 2016 at 2:14:23 PM UTC+1, René Gallati wrote:
>
> Hello all,
>
> is it possible to get the groupname(s) where a host is placed from 
> inventory to use later? I have a situation like this:
>
> [setA]
> HostA
> HostB
>
> [setB]
> HostC
> HostD
>
> [setC]
> HostE
> HostF
>
> So when I'm running on HostC, it should somehow know it is in setB so that 
> I can iterate over all other hosts in the same group and do something 
> specific with that.
> I know how to do it manually, but it looks very redundant in the config 
> file to add a custom variable like
>
> [setN]
> HostXX set_name=setN
> HostXY set_name=setN
>
>
> just to be able to get at the group name.
>
> Thanks for any hints
>
>

-- 
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/d4ace99c-a7aa-4e2a-b297-7d23611b0f25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to