Tags
Tags let one plan serve several jobs: push only the configuration, skip the slow steps, or rerun just the deploy. Tag steps in the plan, then pick them on the command line.
plan "web" { step "Detect version" tags="always" { shell "cat /opt/app/VERSION" register="version" } step "Install packages" tags="packages" { package "nginx" state="present" } step "Deploy config" tags="config" { file "/etc/nginx/nginx.conf" src="nginx.conf" } step "Start nginx" tags="service" { systemd "nginx" state="started" enabled=#true } step "Warm caches" tags="config,slow" { shell "/opt/app/bin/warm --version ${version}" }}glidesh run -i inventory.kdl -p plan.kdl --tags config # Detect, Deploy, Warmglidesh run -i inventory.kdl -p plan.kdl --tags config --skip-tags slow # Detect, Deployglidesh run -i inventory.kdl -p plan.kdl --skip-tags packages # everything but Installtags="a,b"goes on a step: comma-separated names without spaces. A step withouttagshas none.--tags a,bruns only the steps carrying at least one of the named tags. Without--tags, every step is selected.alwaysis a tag like any other, except that--tagsalways selects it. Use it for steps whoseregistervariables later steps need.--skip-tags x,yleaves out every step carrying any of the named tags. It wins over--tagsand overalways.- A tag no step carries is an error, reported before connecting to any host or asking
for the secrets passphrase. A typo in
--tagswould otherwise run nothing, and one in--skip-tagswould run the very steps it meant to hold back. With an inventory whose groups run different plans, a tag counts as known if any of those plans uses it. - Tags work with included plans: an included step keeps its tags,
and
include "roles/db.kdl" tags="db"addsdbto every step that include brings in, nested includes too. Those tags count as in use for the unknown-tag check. - Only steps are tagged.
tags=on a built-in module’s task is an error; move the task to a step of its own. An external module may take its owntagsparameter, which is passed to the plugin as usual.
What a left-out step does
Section titled “What a left-out step does”A step left out by tags behaves like a step whose when= does not
hold:
- It is reported as
skipped, with the reason —skipped (--skip-tags slow)orskipped (not in --tags config)— and counts toward the run’s skipped total. - It does not trigger its subscribers. A subscriber that is itself selected still runs, but is not triggered.
- Its
registervariables stay undefined. A later step that uses one fails, unless itswhen=checksdefined ${var}first. Tag the step that registers the variablealways, or give both steps the same tag. - Its
when=is not evaluated.
In sync mode, hosts still wait for each other at every step, selected or not. Tags combine
with --dry-run and --target.

