Ok,
In this case its because [cluster1] makes up one cluster of dbservers and
[cluster2] is another cluster, and those identifiers are used as the
cluster-name for each config. But those can easily be passed in as a
parameter so its not really a problem.
I just ran a few tests and noticed that the variable 'group_names' does
contains the hostgroup [cluster1]
- name: test
debug: msg="Running against hostgroup {{ group_names }} "
with_items: groups['cluster1']
Output (snipped):
ok: [node1] => (item=node1) => {
"item": "node1",
"msg": "You are running against hostgroup ['cluster1'] "
}
ok: [node2] => (item=node1) => {
"item": "node1",
"msg": "You are running against hostgroup ['cluster1'] "
....
Anyway, thanks for the help.
/M
On Friday, August 29, 2014 1:47:57 PM UTC+2, Michael DeHaan wrote:
>
> "Is there a way to (in the play) get info on which group the play is
> running against?"
>
> In recent versions, should you need this, the variable "play_host"
> contains the list of all hosts currently being targetted.
>
> There is no variable that gives you the host specifier, which is largely
> ok, because you also have no function that would resolve it.
>
> I'm curious as to why it would be needed.
>
>
>
>
> On Fri, Aug 29, 2014 at 12:53 AM, Mikael Sandström <[email protected]
> <javascript:>> wrote:
>
>> Awesome, thanks!
>>
>> So given:
>> [dbservers]
>> Node1
>> Node2
>>
>> Is there a way to (in the play) get info on which group the play is
>> running against?
>> I.e something that will tell me 'dbservers'?
>> Or is that something I have pass in as a variable?
>>
>> /M
>>
>> --
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/7d254bd2-c284-4607-bed1-3c57501f323a%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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/0bd9e4da-3e9a-47b1-807c-acf879de1c71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.