On Wed, Oct 24, 2018 at 12:17 PM flowerysong <[email protected]> wrote:

>
> Not in a host pattern. no. If you can't do it in the inventory, you can do
> it with a dynamic group:
>
> - hosts: localhost
>   gather_facts: false
>   tasks:
>     - add_host:
>         name: "{{ item }}"
>         groups: target_hosts
>       when: hostvars[item].group_names | intersect(['dc1', 'dc2', 'dc3'])
>       loop: "{{ groups.webserver | union(groups.dbserver) }}"
>
> - hosts: target_hosts
>   tasks:
>     - command: /bin/true
>
>
Thanks for that! Very useful.

- Gonz

-- 
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/CAHpidMCj6eS3%3DYKmiodJDL8sxkb0znyetyRdva%2BXfns9gpSyKw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to