- 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]> 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].
> 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/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/CA%2BnsWgwr%2Bi5%2BJLYj3Xc2NG8GA9pSX%2BYf8VupM18%2BbtL6Uf6Eag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to