# use item in a template

**URL:** <https://forum.ansible.com/t/use-item-in-a-template/21563>\
**Category:** Ansible Project\
**Created:** [May 25, 2016, 1:01pm UTC](https://forum.ansible.com/t/use-item-in-a-template/21563 "2016-05-25T13:01:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anoop\_Alias](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@Anoop\_Alias](https://forum.ansible.com/u/Anoop_Alias)\
**Post date:** [May 25, 2016, 1:01pm UTC](https://forum.ansible.com/t/use-item-in-a-template/21563/1 "2016-05-25T13:01:25Z")

</div>

cat main.yml

`

---

<div class="post-metadata">

**Author:** ![Anoop\_Alias](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@Anoop\_Alias](https://forum.ansible.com/u/Anoop_Alias)\
**Post date:** [May 25, 2016, 4:34pm UTC](https://forum.ansible.com/t/use-item-in-a-template/21563/2 "2016-05-25T16:34:52Z")

</div>

As an update the problem seem to be somewhere in the template module as it shows the same error even after I remove the variable item from the jinja2 template

`

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [May 25, 2016, 5:27pm UTC](https://forum.ansible.com/t/use-item-in-a-template/21563/3 "2016-05-25T17:27:02Z")

</div>

It seems as though your `with_items` on your `template` task is indented too far. It should be indented to the same level as the word `template`. Just like you have it for your debug command.

---

<div class="post-metadata">

**Author:** ![Anoop\_Alias](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@Anoop\_Alias](https://forum.ansible.com/u/Anoop_Alias)\
**Post date:** [May 26, 2016, 1:03am UTC](https://forum.ansible.com/t/use-item-in-a-template/21563/4 "2016-05-26T01:03:33Z")

</div>

Hi Matt,

Yes, that was it. Thanks for the help.
