If you are adding a tag to a role, there is no need to use the same tag on any of the tasks within the role.
So running your playbook with -t config_apache will include both tasks. Running it with -t apache_install will only run the Install apache task. http://docs.ansible.com/ansible/latest/playbooks_tags.html#tag-inheritance On Wednesday, August 16, 2017 at 8:17:37 PM UTC-5, Anfield wrote: > > Trying to run an example from the ansible docs, and it seems to always run > both the tagged portions of the playbook... > > Am I missing how calling a role with tags is supposed to be used? > > Ansible docs - > > http://docs.ansible.com/ansible/latest/playbooks_tags.html > > roles: > - { role: webserver, port: 5000, tags: [ 'web', 'foo' ] } > > My playbook and role call below -> > > > Role call > > > --- > - hosts: 10.10.0.5 > become: yes > roles: > - {role: apache, tags: [ 'config_apache']} > > tasks/main.yml > > - name: Install apache > yum: > name: httpd > state: latest > tags: apache_install > > - name: Config apache > lineinfile: > path: /etc/httpd/conf/httpd.conf > line: penguin > tags: config_apache > > > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/fc1b9b5b-2c0c-4699-9c14-75eac4cbe160%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.