In ansible, how do I specify an exclusion set of hosts in a playbook?
You specify the hosts for a playbook on the line that begins with hosts:
.
From the documentation:
The
hosts
line is a list of one or more groups or host patterns, separated by colons, as described in the Working with Patterns documentation.
For example:
---
- hosts: all,!ntpservers
tasks:
# ... your tasks here
roles:
# ... etc etc etc
These roles and tasks will be appled to all
hosts except ntpservers
.