# jinja2 variable substituion

**URL:** <https://forum.ansible.com/t/jinja2-variable-substituion/25809>\
**Category:** Ansible Project\
**Created:** [October 24, 2017, 12:42pm UTC](https://forum.ansible.com/t/jinja2-variable-substituion/25809 "2017-10-24T12:42:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hudec\_Peter](https://avatars.discourse-cdn.com/v4/letter/h/a87d85/32.png) [@Hudec\_Peter](https://forum.ansible.com/u/Hudec_Peter)\
**Post date:** [October 24, 2017, 12:42pm UTC](https://forum.ansible.com/t/jinja2-variable-substituion/25809/1 "2017-10-24T12:42:00Z")

</div>

Hi,

I will try to simplify my problem as much as possible. In my case the  
auto generated, so I do not know the variable name before. Maybe this is  
better question to devel, but will try you guys.

Consider to have values, doesn't matter in which scope

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [October 24, 2017, 2:20pm UTC](https://forum.ansible.com/t/jinja2-variable-substituion/25809/2 "2017-10-24T14:20:41Z")

</div>

vars does not do recursive templating, just use {{var2}}

---

<div class="post-metadata">

**Author:** ![Hudec\_Peter](https://avatars.discourse-cdn.com/v4/letter/h/a87d85/32.png) [@Hudec\_Peter](https://forum.ansible.com/u/Hudec_Peter)\
**Post date:** [October 24, 2017, 8:55pm UTC](https://forum.ansible.com/t/jinja2-variable-substituion/25809/3 "2017-10-24T20:55:39Z")

</div>

thanks, but I can't. The variable name is constructed ...

That means I need to change the way how work with variables.
