I want to execute tasks marked with aaaa from testrole:
[root@wildfly ~/ansible]$ cat test.yml
---
- hosts: local
roles:
- {role: testrole, tags: ['aaaa']}
here is the role:
[root@wildfly ~/ansible]$ cat roles/testrole/tasks/main.yml
---
- name: aaaa tag
local_action: command echo
tags:
- aaaa
- name: bbbb tag
local_action: command echo
tags:
- bbbb
but both tasks are executed:
[root@wildfly ~/ansible]$ ansible-playbook -i inventory.ini test.yml
PLAY [local] ******************************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [testrole | aaaa tag] ***************************************************
changed: [localhost -> 127.0.0.1]
TASK: [testrole | bbbb tag] ***************************************************
changed: [localhost -> 127.0.0.1]
PLAY RECAP ********************************************************************
localhost : ok=3 changed=2 unreachable=0 failed=0