# Error with jinja2 templating for a conditional

**URL:** <https://forum.ansible.com/t/error-with-jinja2-templating-for-a-conditional/28602>\
**Category:** Ansible Project\
**Created:** [September 18, 2018, 9:59pm UTC](https://forum.ansible.com/t/error-with-jinja2-templating-for-a-conditional/28602 "2018-09-18T21:59:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris7](https://avatars.discourse-cdn.com/v4/letter/c/439d5e/32.png) [@Chris7](https://forum.ansible.com/u/Chris7)\
**Post date:** [September 18, 2018, 9:59pm UTC](https://forum.ansible.com/t/error-with-jinja2-templating-for-a-conditional/28602/1 "2018-09-18T21:59:28Z")

</div>

Hello,

Will someone please help me understand why this is not work?

Thanks!

---

<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:** [September 18, 2018, 10:56pm UTC](https://forum.ansible.com/t/error-with-jinja2-templating-for-a-conditional/28602/2 "2018-09-18T22:56:46Z")

</div>

You cannot use a variable as the name of the var to be registered. It must be an explicit static string.

See the following info on the structure of registered data when using a loop:

[https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_loops.html#using-register-with-a-loop](https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#using-register-with-a-loop)
