I have a playbook like that, with one role per client.
- hosts: hosting
roles:
- { role: client1, tags: ['client1'] }
- { role: client2, tags: ['client2'] }
And on each role, I have a dependency on nginx for example.
/roles/client1/meta/main.yml
dependencies:
- nginx
I would like to not launch the nginx role when it is not necessary. So I have added the nginx tag to the dependency.
/roles/client1/meta/main.yml
dependencies:
- { role: nginx, tags: ['system'] }
But when I launch the playbook with the tag client1, the nginx role is executed. Is there a solution to avoid that ?
I know a can "export" the dependency on the playbook, it works good, but it's not a nice solution I think.
- hosts: hosting
roles:
- { role: nginx, tags: ['system'] }
- { role: client1, tags: ['client1'] }
- { role: client2, tags: ['client2'] }