How do you combine group patterns in `--limit`?
BeginnerProductionRapid-Fire Commands
Answer
ansible-playbook site.yml --limit 'web:&prod' # in web AND prod
ansible-playbook site.yml --limit 'web:!web03' # web except web03
ansible-playbook site.yml --limit 'web:db:&eu' # (web OR db) AND eu
ansible-playbook site.yml --limit '~web0[1-3]' # regex
Quote the pattern so the shell does not interpret ! or &. Confirm with --list-hosts before running.
More on Rapid-Fire Commands
How do you see which hosts a playbook would run against, without running it?BeginnerHow do you list the tasks and tags a playbook contains?BeginnerHow do you inspect the inventory structure and a host's variables?BeginnerHow do you restart a service on a group with an ad-hoc command?BeginnerHow do you resume a playbook from a specific task or step through it?BeginnerHow do you re-run a playbook only on the hosts that failed?Intermediate