host pattern

An expression that picks which hosts a command or play runs against, built from host names, group names and operators.

In more detail

A group name selects the group and its children; a colon joins two selections; :! removes one; :& keeps only hosts in both; and a star is a wildcard on names. Patterns are evaluated left to right and should be quoted in the shell, because ! and & mean something to it. Check a pattern with --list-hosts before running anything that changes machines.

Example

ansible 'production:!dbservers' --list-hosts

Related terms

Taught in

References

Certification courses