Interview Prep/Ansible/Rapid-Fire Commands

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.

All Ansible questions Roadmap: Ansible

More on Rapid-Fire Commands