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
- OSUbuntu 26.04 LTS
- ansible-core2.20.1
- Python3.14.4
- TimeAbout 14 min
- Reviewed23 August 2026
Written against the versions above. `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.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| ANS-CTL01 | 192.168.0.36 | Ubuntu 26.04 LTS | Ansible Control Node | 2 Core | 3 GB | 50 GB |
| ANS-A01 | 192.168.0.37 | Ubuntu 26.04 LTS | Managed Node (group: web) | 2 Core | 3 GB | 50 GB |
| ANS-B01 | 192.168.0.38 | Ubuntu 26.04 LTS | Managed Node (group: db) | 2 Core | 3 GB | 50 GB |
Before you start
- A control node configured as shown in the first step.
- The session runs one tagged playbook several different ways and changes nothing.
-
The configuration this guide assumes
-
A playbook with tags
-
Running only part of it
-
The two special tags
-
Limiting to some hosts
-
Starting part way through