That works sort of, however it does become repetitive.

Also it doesn't work very well when using --limit on the command-line, 
after all there needs to be association between webserver1,2,3 and master1 

On Friday, December 19, 2014 3:45:06 PM UTC+1, Michael DeHaan wrote:
>
> - hosts: headnode
>   tasks:
>     - ... # run once stuff goes here
>
> - hosts: webservers
>   tasks:
>     - ... # stuff to do to everything
>
> Alternatively:
>
> when: inventory_hostname == groups['webservers'][0]
>
>
>
> On Fri, Dec 19, 2014 at 8:55 AM, Nico K. <[email protected] <javascript:>
> > wrote:
>
>> Hi,
>>
>> I have groups of hosts that I copy files to, one those files are copied I 
>> call a webservice on the groups master; this webservice will call a 
>> deployment script.
>> The problem I'm having is that the webservice call will be made for every 
>> host but it only needs to be called once per group. The 'run_once' syntax 
>> doesn't help me since if there are multiple groups it will only run once 
>> for everything.
>>
>> Illustrated
>>
>> group1:
>> host1
>> host2
>> host3
>>
>> master1
>>
>> group2: 
>> host4
>> host5
>> host6
>>
>> master2
>>
>> - task runs to populate host*
>> - Webservice on groupX is called for each host
>> - When limiting with "run_once"only one group's webservice would be called
>>
>> Ideally we would have something like 'run_once_per_group'. The only 
>> solution I see at the moment is splitting out the webservice call in a 
>> separate playbook which only runs on the 'masters'.
>> Any other ideas / approaches are welcome.
>>
>> Thanks,
>> Nico
>>
>> -- 
>> 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/1351b47c-50f6-496c-8aa4-d8d5c8a270dc%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/1351b47c-50f6-496c-8aa4-d8d5c8a270dc%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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/90df1416-3351-400c-9cb4-b59dcecea809%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to