First and foremost our inventory script creates *a lot of* groups based on CMDB information, including
Then we have:
- appl (application code, points to a team in the company)
- environment (dev, test, qa, prod)
- securityclass (dmz, fta)
- location (dc1, dc2)
- hardwaretype (vmware, kvm, blade, standalone)
- status (to-be-provisioned, provisioned, accepted, production, maintenance)
And we have some combined groups:
- location-environment
- securityclass-environment
This is mostly based on the need to have variables specific to any of these combinations, or the specific use we have to limit on the command line.
What you can do then is something like:
hosts: webservers:!redhat:!fedora
Which means all the webservers, except the redhat and fedora servers. Which is in set theory the complement. You can make unions too:
hosts: debian:fedora
But what is missing is an intersection option, like (made-up syntax):
hosts: webservers#debian
My preference is to implement union, intersection and complement from set theory and create a syntax for priority rules, etc...