I need to permform few task on same hosts but wanted to group the tasks into the different roles which need to share some output to each other. Consider below example
│── hosts
├── playbooks
│ ├── Playbook1.yml
│
├── roles
│ └── role1
│ ├── files
│ │ └── project1.conf
│ ├── handlers
│ │ └── main.yml
│ ├── meta
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml [Creates variable role1_a, role1_b]
│ ├── templates
│ └── vars
│ └── main.yml
│ └── role2
│ ├── handlers
│ │ └── main.yml
│ ├── meta
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml [uses variable from role1 role1_a and creates variable role2_c]
│ ├── templates
│ └── vars
│ └── main.yml
│ └── role3
│ ├── handlers
│ │ └── main.yml
│ ├── meta
│ │ └── main.yml
│ ├── tasks
│ │ └── main.yml [uses variable from role1 role1_b and role2 role2_c]
│ ├── templates
│ └── vars
│ └── main.yml
│
Is there any way to collect output of role1 and pass it to role2 and role3 like
- hosts: localhost
roles:
- role: role1_a, role1_b = {role1}
- role: role2_c = {role2 role1_a: role1_a, role1_b: role1_b}
- role: {role2 role1_b: role1_b role2_c: role2_c}
or anyother mechanism to share the variable between the roles ?