Ansible - Tag

Card Puncher Data Processing


A tag permits to filter the execution of tasks


special keywords:

  • tagged, - run only tagged
  • untagged - run only untagged
  • all - run all tasks respectively.
  • never - will prevent a task from running unless a tag is specifically requested.

By default, Ansible runs as if –tags all had been specified.

ansible-playbook playbook.yml -i hosts.ini --tags all


- debug:
    msg: "Always runs"
    - always

- debug:
    msg: "runs when you use tag1"
  - tag1

- debug:
    msg:"{{ showmevar }} - run only when a 'debug' tag is specified "
  tags: [ never, debug ]

Documentation / Reference

Discover More
Card Puncher Data Processing
Ansible - Diaganostic

This page gives information on how to debug a problem (diagnostic) for Ansible. verbosity can be given: at the command line: via the environment variable ANSIBLE_DEBUG=1 to see detailed information...

Share this page:
Follow us:
Task Runner