How to run only one role out of a playbook?

Hello

I have a site.yml which imports several playbooks.

  • import_playbook: webservers.yml

Every playbook “calls” several roles:

  • name: apply the webserver configuration
    hosts: webservers

roles:

  • javajdk
  • tomcat
  • apache

Now how can I run lets say only the javajdk role ?

ansible-playbook -i inventory/xx webservers.yml would run all roles… I know that there are tags, but how do I assign them to a role in general?

Thanks a lot
Michael

If you tag the roles, you can use ansible-playbook --tags some-tag

Hello thank,

well I can have - role: javajdk
tags: javajdk

but this tags this role in this ONE palybook. But if I run an other playbook with - role: javajdk there is not tag.
So either I have to tag it every time or, smater, I would tag the role itself. But I have not found a method to do so

Michael

just reference the role directly, its much simpler than calling other
playbooks to just use one of their roles