Member-only story

How to Run Only One Task in Ansible Playbook? — Ansible tags statement

How to select single or multiple tasks, include, import, play, block, and role in an Ansible Playbook using tags parameter of ansible-playbook command.

Luca Berton
5 min readMay 6, 2022

How to run only one task in an Ansible Playbook?

I’m going to show you a live demo with some simple Ansible code.
I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

How use tags statement in Ansible Playbook?

  • --tags all
  • --tags tag1
  • --tags [tag1, tag2]
  • --skip-tags [tag3, tag4]
  • --tags tagged
  • --tags untagged

Today we’re talking about Ansible tags statement.

When your Ansible Playbook starts to grow up it’s useful to define tags to allow a more granular execution.

You could define one or multiple tags at the individual task, include, import, play, block, role level.

--

--

Luca Berton
Luca Berton

Written by Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday

No responses yet