Hi!
I'm pretty used to ansible typical framework layout, which means:
a) I have few roles applying single function to undefined hosts
b) I have a playbook that applies roles to named groups of hosts
c) I have some group_vars for that playbook for some specific setup.
d) and of course I have hosts file defining my inventory where I map groups
to physical hosts.
Now I have few of such frameworks implemented, where each as you see
creates a whole infrastructure, a cluster of nodes. E.g. One is HDP
hortonworks hadoop, the other one is Mesos and docker, the other one is
Monitoring setup (graphite, grafana and others). Each of it can function on
its own, completely separate of each other.
Now, I would like to reuse those frameworks, which mean bring in a
framework that reuse those as subframeworks. What is a best practice in
Ansible to do it?
The best I could come up with is to have this structure:
- framework-1
- roles
- framework-1-role
- group_vars
- framework-1-group-1.yml
- framework-1-group-2.yml
- framework-1-site.yml
- framework-2
- roles
- framework-2-role-1
- framework-2-role-2
- group_vars
- framework-2-group-1.yml
- framework-2-group-2.yml
- framework-2-site.yml
global-site.yml
global-inventory
group_vars
Where global-site.yml includes the sub-frameworks (e.g. - include:
framework-1/framework-1-site.yml)
It isn't the best design. What hits me the most is that group_vars for
sub-framework is totally ignored. I have to create a group_vars on global
level that copies all variables from the sub-frameworks. While I would like
to have some good defaults on the level of groups of sub-framework already
there.
Other than that, I'm not sure it's the right approach to the problem. What
do you think? Roles are for me of no use here, as I want to have a "higher
level roles", that configure how other roles are applied to the separate
groups of nodes.
And the important part here is reusability. So that I can just put a
sub-framework as a git submodule in the global framework, without modifying
it at all.
I'll be grateful for any advice you have.
--
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/214c555f-f9c1-4a69-9c09-a1f81ecffa20%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.