On Wed, Oct 24, 2018 at 2:29 AM flowerysong <[email protected]> wrote:
> On Tuesday, October 23, 2018 at 2:24:59 AM UTC-4, Gonzalo Servat wrote: >> >> Hi All >> >> When working with host patterns >> <https://docs.ansible.com/ansible/2.7/user_guide/intro_patterns.html>, >> is it possible to craft one that says "must be in group X *and* must be in >> either group Y, W and Z"? >> >> e.g. host must be in group "webserver" but it *must* also be in either >> group dc1, dc2 or dc3. >> >> I can see how to check that webserver is part of dc1 (webserver,&dc1) but >> not sure how to build it with multiple "OR" on the "AND" (something like >> "webserver,&(dc1,dc2,dc3)" is what I'm looking for but it doesn't work) >> > > You're trying to do it backwards. Build the union of your other groups and > do the intersection with webserver. > > &webserver,dc1,dc2,dc3 > Thanks, good suggestion. I suppose there's no way to say "must be webserver OR dbserver AND in (dc1 OR dc2 OR dc3)"? - 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/CAHpidMBcmJ1PUezgakur3R7%3DFSHW%3Ds5ZvRuNnuZH6KGzR7tvdA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
