Thanks, Michael! But can I do the following?
$ cat site.yml
---
- hosts: all
tasks:
# Set up OS-specific groups
- group_by:
key=os-{{ansible_distribution}}-{{ansible_distribution_version}}
- hosts: "{{ distro | default('all') }}"
include:
- dept1-servers.yml
- dept2-servers.yml
- base-static-setup.yml
Rather not change the individual playbooks if I can help it.
Thanks,
Will
On Friday, September 12, 2014 11:42:55 AM UTC-4, Michael DeHaan wrote:
>
> Sorry in the above, the word "distro" should be "pattern".
>
>
>
> On Fri, Sep 12, 2014 at 11:42 AM, Michael DeHaan <[email protected]
> <javascript:>> wrote:
>
>> You can't use group_by stuff at that point because it hasn't run yet,
>> true, but there is a solution to what you would like to do, using two plays
>> in the same playbook
>>
>> - hosts: all
>> tasks:
>> - group_by: key=os-{{ ansible_distribution }}
>>
>> - hosts: "{{ distro | default('all') }}"
>> tasks:
>> - action: ping
>> - ...
>>
>> ansible-playbook foo.yml -e "pattern=os-Fedora"
>>
>>
>>
>> On Fri, Sep 12, 2014 at 10:54 AM, Serge van Ginderachter <
>> [email protected] <javascript:>> wrote:
>>
>>>
>>> On 12 September 2014 16:48, Willard Dennis <[email protected]
>>> <javascript:>> wrote:
>>>
>>>> So am I doing this incorrectly, or for some reason, is the "os-Fedora"
>>>> group empty? (i.e. the logic is not matching any hosts)
>>>
>>>
>>>
>>> The --limit happens early, at initialization, and at that time the
>>> group is indeed empty.
>>>
>>> AFAIK, there is no workaround for this.
>>>
>>> --
>>> 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/CAEhzMJCq7U64k88uUMmFhO_Arwqr%3DhOdFCTzHUgMLg8jxiPD4Q%40mail.gmail.com
>>>
>>> <https://groups.google.com/d/msgid/ansible-project/CAEhzMJCq7U64k88uUMmFhO_Arwqr%3DhOdFCTzHUgMLg8jxiPD4Q%40mail.gmail.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/3b52b32c-c534-4b99-9af6-5544bc4d85e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.