I have a set of hosts named vm2-prod
through vm14-prod
. These are grouped in the Ansible hosts inventory as vmware_hosts
. I want to exclude a subset of hosts like this:
- name: testing play
hosts: vmware_hosts:!vm[8-10]-prod
According to the Ansible docs, it seems this should exclude vm7-prod
through vm9-prod
. However, I get the "could not match host pattern, ignoring vm[8-10]-prod" like it's reading the literal host name "vm[8-10]-prod" rather than an array.
I also tried vm[8:10]-prod
, but it gives the same error.
What is wrong?
...the pattern ':!' only allows you to exclude groups.
=> The documentation is listing "common" patterns. I'm actually not sure I agree with the authors it's "uncommon", but excluding a single host (or several as you later show in your answer) is totally possible. This statement is hence wrong. – Hemianopsia