Jan 29, 2020 in Ansible
Q: Explain Ansible Tags

1 Answer

0 votes
Jan 29, 2020

If you have a large playbook, it becomes useful to be able to run only a specific part of it rather than running everything in the playbook. Ansible supports a tag attribute for this reason.

When you apply tags on things, then you can control whether they are executed by adding command-line options.

When you execute a playbook, you can filter tasks based on the tags in two ways, such as:

  1. tasks:  
  2. - yum:  
  3.     name: "{{ item }}"  
  4.     state: present  
  5.   loop:  
  6.   - httpd  
  7.   - memcached  
  8.   tags:  
  9.   - packages  
  10.   
  11. - template:  
  12.     src: templates/src.j2  
  13.     dest: /etc/foo.conf  
  14.   tags:  
  15.   - configuration  
Click here to read more about Ansible
Click here to read more about Insurance

Related questions

0 votes
Nov 13, 2019 in Ansible
...