The always & never Special Tags
Force or block tasks regardless.
The always & never Special Tags is a free Ansible Academy lesson on CoddyKit. This is lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Ansible Academy learning path, and your progress syncs across the web and the CoddyKit app. The Ansible Academy course includes 4 lessons in total.
Two Reserved Tags
Ansible reserves two special tag names with built-in behavior: always and never. They are not filters but rules. 🔒
always Runs Every Time
A task tagged always runs in every play, no matter which --tags you pass. It is perfect for must-do setup.
- name: Gather setup
ansible.builtin.setup:
tags:
- alwaysSkipping always
There is one escape hatch: passing --skip-tags always will exclude even those tasks when you really need to.
ansible-playbook site.yml --skip-tags alwaysA Good Use for always
Loading variables or facts that later tasks depend on is ideal for always, so they exist no matter how you filter.
- ansible.builtin.include_vars: app.yml
tags:
- alwaysnever Stays Hidden
A task tagged never is skipped by default. It runs only when you explicitly ask for it or another of its tags.
- name: Wipe database
ansible.builtin.command: drop-all
tags:
- never
- debugOpting Into never
To run a never task, name it directly with --tags. Asking for it overrides the default skip.
ansible-playbook site.yml --tags debugnever for Dangerous Steps
Use never to guard risky or rarely needed tasks, like destructive cleanup, so they never fire by accident.
Pairing never With a Real Tag
Give a never task a second tag too. Then you trigger it by that friendly name while never keeps it safely off by default.
always Beats Selection
Even if you run --tags config, every always task still executes alongside your selected ones. It is additive.
Two Opposite Defaults
Remember the symmetry: always opts a task in unless skipped, and never opts it out unless requested.
A Safe Cleanup Task
This destructive task carries never plus a cleanup tag, so it only runs when you deliberately ask for cleanup. 🛡️
- name: Reset state
ansible.builtin.command: reset.sh
tags:
- never
- cleanupQuick Check
A task is tagged only with never. When does it run?
Recap
You learned always runs unless skipped, and never stays off until you explicitly request its tag, guarding risky tasks. ✅
Frequently Asked Questions
Is the “The always & never Special Tags” lesson free?
Yes — the full text of “The always & never Special Tags” is free to read here on the web. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Ansible Academy course, upgrade to CoddyKit PRO. The Ansible Academy course includes 4 lessons in total.
What will I learn in “The always & never Special Tags”?
Force or block tasks regardless. You practise Ansible Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Ansible Academy?
No prior experience is required. Ansible Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 3 of 4.
How long does the “The always & never Special Tags” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Ansible Academy lesson?
Yes. Every Ansible Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Tagging Tasks, Plays & Roles
- Filter Runs with --tags & --skip-tags
- The always & never Special Tags
- List Tags & Tasks Before Running