Hi, I have a template with a playbook running 2 roles. Each role has to be ran on a specific set of hosts. So, created an inventory with all the hosts and within this inventory created 2 groups. How do I call each role from the main playbook with the hosts group it needs to ran on?
You can use the group_names special var in a when condition with import_role/include_role tasks and play roles:. If you don’t want to see the role tasks skipped for hosts outside of the group you’re trying to match, use include_role: