# Template Calls List of Variables to Build Config

**URL:** <https://forum.ansible.com/t/template-calls-list-of-variables-to-build-config/17576>\
**Category:** Ansible Project\
**Created:** [February 20, 2015, 3:28pm UTC](https://forum.ansible.com/t/template-calls-list-of-variables-to-build-config/17576 "2015-02-20T15:28:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Short](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@Chris\_Short](https://forum.ansible.com/u/Chris_Short)\
**Post date:** [February 20, 2015, 3:28pm UTC](https://forum.ansible.com/t/template-calls-list-of-variables-to-build-config/17576/1 "2015-02-20T15:28:16Z")

</div>

I’m trying to simplify a DNS sinkhole configuration with Ansible. Ultimately what I’d like is a file full of domains (potentially hundreds). I’d then like a template that has one line that iterates through the list of domains build a config file. The config file is essentially multiple similar lines where the only thing that changes is the domain. I’m not quite sure how to get Ansible/Jinja to do this for me though. Thoughts?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 20, 2015, 3:33pm UTC](https://forum.ansible.com/t/template-calls-list-of-variables-to-build-config/17576/2 "2015-02-20T15:33:58Z")

</div>

something like:

vars:  
&nbsp;&nbsp;sinkhole:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- host1  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- fqdn2.exmaple.com  
&nbsp;&nbsp;....

- template: src=sinkhole.j2 ....
