Difference between revisions of "Ansible Tags"
Jump to navigation
Jump to search
Line 25: | Line 25: | ||
'''To Skip a task using tag. the entire playbook would run except that tag ''' | '''To Skip a task using tag. the entire playbook would run except that tag ''' | ||
ansible-playbook ymlfile.yml --skip-tags tagname | ansible-playbook ymlfile.yml --skip-tags tagname | ||
=[[Ansible| Ansible Menu]]= | |||
[[Category:Ansible]] |
Latest revision as of 16:20, 14 July 2022
Ansible Tags
Tags are the reference or alias to a task
--- - name: setup apache ser er hosts: localhost tasks: apt: name: apache2 state: present tags: i-apache -name: start apache service: name: apache2 state: started tags: start_apache2
- The tag name could be anything
ansible-playbook nameofymlfile.yml -t tagname
- the
-t
flag must precede the tagname in the yml file
To list all tags that are in a playbook
ansible-playbook ymlfile.yml --list-tags
To Skip a task using tag. the entire playbook would run except that tag
ansible-playbook ymlfile.yml --skip-tags tagname