I want to run playbooks according to role
host file will contain all host:groups
if role a and group a:
run playbook a
if role b and group b
run playbook b etc
Or if we give role in runtime, it will run the playbook corresponding to it
I want to run playbooks according to role
host file will contain all host:groups
if role a and group a:
run playbook a
if role b and group b
run playbook b etc
Or if we give role in runtime, it will run the playbook corresponding to it
Your roles sounds like 'other type of group', i.e webserver, dbserver,
just define those as groups in Ansible. and then:
hosts; rolea:&groupa
^ play runs against hosts in BOTH groups.
In Ansible 'role' means a 'reusable component' that can be
tasks/templates/vars/etc, it is not associated to a host directly,
that is what plays do.
So what if I want to run playbook a,b,c if group a and c,d,e if group type is b
can it be achieved via one combined playbook
you can have many plays per playbook or even include other playbooks
in a playbook, not sure what your combinations above mean, but you
should be able to adjust the hosts: keyword to whatever you want.