how to use tags in ansible code example
Example 1: ansible tags
ansible-playbook example.yml --tags "configuration,packages"
Example 2: ansible tags
tasks:
- yum:
name:
- httpd
- memcached
state: present
tags:
- packages
- template:
src: templates/src.j2
dest: /etc/foo.conf
tags:
- configuration
Example 3: how to use tags in ansible
# Tags goes at same indentation as name or service:
- name: Create Postgres Container
tags: createcontainer
docker_container:
name: mypostgres
...
# Then in the command line:
ansible-playbook myplaybook.yaml --tags createcontainer