CertGrid CertGrid
Hands-on Lab·Ansible

Running Selected Ansible Tasks with Tags

A long playbook that can only be run in full is painful to develop and dangerous to re-run. Three flags fix that: tags select tasks, --limit selects hosts, and --start-at-task skips ahead. Two special tag names change the rules, and both are worth knowing before you meet them by accident.

Scale and Debugging Guide 38 of 45 Beginner

always and never are reserved tag names with built-in behaviour. A task tagged always runs whatever you select, unless you explicitly --skip-tags always. A task tagged never runs only when one of its tags is named. They are the mechanism for sanity checks and for destructive steps respectively.

Both managed nodes, so `--limit` has something to narrow.
Server NameIP AddressOSRolesCPURAMHDD
ANS-CTL01192.168.0.36Ubuntu 26.04 LTSAnsible Control Node2 Core3 GB50 GB
ANS-A01192.168.0.37Ubuntu 26.04 LTSManaged Node (group: web)2 Core3 GB50 GB
ANS-B01192.168.0.38Ubuntu 26.04 LTSManaged Node (group: db)2 Core3 GB50 GB

This guide includes

Use this when a long playbook can only be run in full. This matters because that makes it painful to develop and dangerous to re-run - tags let you run one part, and two special tags behave unlike the rest.

Before you start

  1. The configuration this guide assumes

  2. A playbook with tags

  3. Running only part of it

  4. The two special tags

  5. Limiting to some hosts

  6. Starting part way through

Official sources