Tags¶
Section status: outline
This page is scoped but not yet written in full prose. The sections below define what it will cover.
Why This Exists¶
A large playbook shouldn't need editing just to run a subset of it during debugging or a partial deploy — tags give every task, block, or role a label that --tags/--skip-tags can filter on at run time.
What It Will Cover¶
- Applying
tags:to a task, a block, and an entire role ansible-playbook site.yml --tags config,restartansible-playbook site.yml --skip-tags slow_checks- The special
alwaysandnevertags ansible-playbook --list-tagsto discover what a playbook supports without reading the whole file
Common Mistakes¶
- Tagging every task with the same tag, making
--tagsfiltering meaningless. - Forgetting that
import_tasksresolves tags at parse time whileinclude_tasksresolves them at run time — see Imports vs. Includes — which changes what--list-tagscan see ahead of a run.
Interview Questions¶
- How would you run only a subset of a 200-task playbook without editing it?
- What do the
alwaysandneverspecial tags do?
Next¶
Continue to Check Mode and Diff Mode.