Hi list,
My use case:
At $WORK, we divise our ansible repo in multiple projects/* dirs, where all projects have their own hosts file and group_vars/; a wrapper script merges all these together in $basedir; basically having all group_vars files in one big directory is too big here (we have 800 hosts and almost 300 groups).
(This should better be handled by some backend + inventory script, but for now, that’s what we have. )
Now, one optimisation, would be for us to get rid of that part in the wrapper script, basically allowing to organise goup_vars/ and host_vars/ files into subdirectories.
Basically what I want is, instead of having
group_vars/
group_vars/project1group1
group_vars/project1group2
group_vars/project2group1
group_vars/project2group2
I want to have this:
group_vars/
group_vars/project1/project1group1
group_vars/project1/project1group2
group_vars/project1/project2group1
group_vars/project1/project2group2
The only problem I see with that, is that would allow to have multiple files for the same group, such as
group_vars/
group_vars/project1/project1group1
group_vars/project2/project1group1
Which would probably confusing, and not clear which logic is implemented on which variable gets precedence when that same variable is defined in multiple files with the same group name, hence for the same group.
(in our case, we just wouldn’t have that, by convention, but it would be possible to abuse)
group_vars/ and host_vars/ are handled by the vars_plugins/group_vars plugin, and looking at the code, that could be done with a small and simple patch.
Your ideas?
Serge