# for loop in template gives error undefined variables: list object has no element

**URL:** <https://forum.ansible.com/t/for-loop-in-template-gives-error-undefined-variables-list-object-has-no-element/17126>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [December 22, 2014, 2:55pm UTC](https://forum.ansible.com/t/for-loop-in-template-gives-error-undefined-variables-list-object-has-no-element/17126 "2014-12-22T14:55:20Z")\
**Posts on this page:** 1\
**Page:** 1

<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:** [December 22, 2014, 2:55pm UTC](https://forum.ansible.com/t/for-loop-in-template-gives-error-undefined-variables-list-object-has-no-element/17126/1 "2014-12-22T14:55:20Z")

</div>

I believe you need to make 2 changes:

loop.index instead of usenet\_servers[server].loop.index

And just use server instead usenet\_servers[server] everywhere else. server isn’t the index, it is the actual hash/dict.
