1.

Explain Ansible tags?

Answer»

Ansible tags are very useful when the playbook is large. It may become useful to be able to RUN only a specific part of it rather than running EVERYTHING in the playbook. For example, a playbook CREATES 3 users but in some cases, you need only 1 user from it, so here tag is a big savior. 

During playbook EXECUTION, tasks can be filtered out in two ways:

  • On the command line, with –tags or –SKIP-tags options.
  • In Ansible configuration settings, with the TAGS_RUN and TAGS_SKIP options.

Skip tags can be used to skip one or more tag, it can be defined in the command line as –skip-tags   ‘tag1,tag2’. On the other hand, --tags helps to execute one or tags associated with the mentioned tag.



Discussion

No Comment Found