I hope someone can help me, i am trying to use common vars for all roles in my playbook. For example, within roles, I have "inf_role1", "inf_role2", "inf_role3" and would like here to place folder (if possible) "common", where would be vars, handlers for all roles. I have tried this combination and vars are not executed. I am trying to avoid group_vars and hosts_vars, so only interested within roles.
Thanks in advance
CodePudding user response:
I think you could create a common role, e.g. inf_role0
, which would have all the common definitions. To call this new common role from the other ones you could declare it as a dependency in the meta/main.yml
file on each of the other roles.
meta/main.yml
dependencies:
- inf_role0
More information on the Running role dependencies multiple times in one play section of the Roles user guide.
CodePudding user response:
This work just as i needed, thanks for this. I have also included in dependecies: - roles: role_name so i can connect roles between themselves which is also good. Thanks again Antonio!