The task-less role is good because you can capture the dependency fully in the role (via meta/main.yml dependencies) without depending on some externally defined data. Further, your data would follow your roles if you want to use those roles in another project.
The group_vars/all could also work well in your design IF your roles that depend on those "shared variables" are designed such that they either (1) fail when those variables aren't defined or (2) you assign sane defaults in the role for the "shared variables". (1) is a common problem for me so I created a required-vars <https://galaxy.ansible.com/detail#/role/6324> role that i reference in meta/main.yml dependencies to ensure per-role variables are defined and/or assigned. On Wednesday, December 30, 2015 at 7:27:21 AM UTC-6, Alexey Vazhnov wrote: > > You can place your common variables in group_vars/all/. > Did you read this http://docs.ansible.com/ansible/playbooks_variables.html > ? > > On Wednesday, December 30, 2015 at 4:48:06 PM UTC+5, Yassen Damyanov wrote: >> >> Guys, >> >> Could you suggest a way to handle data common to a set of roles, e.g. the >> IP address of the DNS or the DHCP server on the network? These seem to be >> fixed for now but can change in future and I'd like to have a convenient >> way to do a change in one place and then have all roles working with the >> new setting. >> >> What I can think of: a dedicated task-less role having these defined in >> its variables; then other roles should depend on it and thus get the >> above-mentioned stuff "for free". >> >> Let know how you do it and what would you recommend. >> Thanks, >> -Y. >> > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/12c496be-53da-4f4c-a3bc-57cc87b785c0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
