Hi,
I’ve a complex data structure to build, which, while I can do it in group/host_vars/ I’m worrying about the people who follow me on, and how they’ll cope with it.
I’ve some experience of Jekyll, which has a good data structure with yml files in a directory, and I’d like, if possible to use that with Ansible. In that system, there is a “data” directory, and each directory under that path is loaded as a dict with the same name as the directory, and then each file under that is loaded as either a variable or a dict again (depending on the content).
So, for example, if I had this structure:
data / dir1 / file1.yml
data / dir2 / dir3 / file2.yml
data / dir2 / dir3 / file3.json
data / file4.yml
I would have these variables loaded:
{
“data”: {
“dir1”: {
“file1”: {{ content_of_file1.yml }}
},
“dir2”: {
“dir3”: {
“file2”: {{ content_of_file2.yml }},
‘file3’: {{ content_of_file3.json }}
}
},
‘file4’: {{ content_of_file4.yml" }}
}
}
Short of writing a lookup or a playbook to load the data like this, are there any modules or plugins I can use already, or import from another project?
Thanks!