# Storing custom data

**URL:** <https://forum.ansible.com/t/storing-custom-data/14378>\
**Category:** Ansible Project\
**Created:** [January 18, 2014, 2:25pm UTC](https://forum.ansible.com/t/storing-custom-data/14378 "2014-01-18T14:25:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathew\_Davies](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@Mathew\_Davies](https://forum.ansible.com/u/Mathew_Davies)\
**Post date:** [January 18, 2014, 2:25pm UTC](https://forum.ansible.com/t/storing-custom-data/14378/1 "2014-01-18T14:25:55Z")

</div>

Hi,

I’m finding myself running into a problem of where to store Apache / Nginx vhosts. I originally planned to abstract the template to a point I could customise it with variables, but that proved a waste of time because they’re so different from one another.

What’s the best way to go about this problem?

I’m undecided if it’s a good idea to store them in a roles “files/” directory and just copy over the ones I need or do something more advanced.

Any real world uses cases would be appreciated.

Kind Regards,  
-Mathew Davies.

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [January 20, 2014, 3:23pm UTC](https://forum.ansible.com/t/storing-custom-data/14378/2 "2014-01-20T15:23:12Z")

</div>

One solution could be to use a variable in the path for the template source. The variable name could be a hostname or some other fact, or a variable you set in groupvars.

For example, the files could be stored as:

templates/foo/test.tmpl  
templates/bar/test.tmpl

Playbook:

vars:

- test1: foo
- test2: bar

tasks:

- template: src=templates/{{test1}}/test.tmpl dest=/tmp/foo.out
- template: src=templates/{{test2}}/test.tmpl dest=/tmp/bar.out
