0Pricing
Ansible Academy · Lesson

Tagging Tasks, Plays & Roles

Attach labels to runnable units.

Why Label Your Work

A big playbook does many things. Tags are simple labels you stick on tasks so you can later run just the parts you want. 🏷️

Tagging a Single Task

Add a tags key to any task with a list of label names. Here the task carries the install tag.

- name: Install nginx
  ansible.builtin.package:
    name: nginx
    state: present
  tags:
    - install

All lessons in this course

  1. Tagging Tasks, Plays & Roles
  2. Filter Runs with --tags & --skip-tags
  3. The always & never Special Tags
  4. List Tags & Tasks Before Running
← Back to Ansible Academy