# Building variables like in Jekyll?

**URL:** <https://forum.ansible.com/t/building-variables-like-in-jekyll/29944>\
**Category:** Ansible Project\
**Created:** [March 21, 2019, 8:56pm UTC](https://forum.ansible.com/t/building-variables-like-in-jekyll/29944 "2019-03-21T20:56:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JonTheNiceGuy](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jontheniceguy/32/2267_2.png) [@JonTheNiceGuy](https://forum.ansible.com/u/JonTheNiceGuy)\
**Post date:** [March 21, 2019, 8:56pm UTC](https://forum.ansible.com/t/building-variables-like-in-jekyll/29944/1 "2019-03-21T20:56:13Z")

</div>

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!
