#cat hosts
[master]
master
[mirror]
mirror
[slaves]
s1
s2
s3
s4
s5
s6
- hosts: master
pre_tasks:
- name: task will run before roles
copy: ...
roles:
- role: master_role
tasks:
- name: task will run after roles
copy: ...
- hosts: mirror
vars:
var_for_mirror_group: 42
roles:
- role: mirror_role
tasks:
- name: task 1
template: ...
- name: task 2
copy: ...
- hosts: slaves
roles:
- role: slaves_role
- hosts: all
roles:
- role: all_together_role