# Can't find error in jinja2 expression

**URL:** <https://forum.ansible.com/t/cant-find-error-in-jinja2-expression/36002>\
**Category:** Ansible Project\
**Created:** [November 16, 2021, 6:50pm UTC](https://forum.ansible.com/t/cant-find-error-in-jinja2-expression/36002 "2021-11-16T18:50:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Axel\_Rau](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@Axel\_Rau](https://forum.ansible.com/u/Axel_Rau)\
**Post date:** [November 16, 2021, 6:50pm UTC](https://forum.ansible.com/t/cant-find-error-in-jinja2-expression/36002/1 "2021-11-16T18:50:26Z")

</div>

Hi all,

in a template, I have:

data\_directory = '{{ {{ i.data }}/{{ postgresql\_version }}/data }}‘

but I’m getting:  
"AnsibleError: template error while templating string: expected token ':', got ‚}'

In the calling ansible block, I have:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;loop:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- '{{ i.data }}/{{ postgresql\_version }}/data/pg\_hba.conf‘

What am I doing wrong?

Any help appreciated

Axel

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [November 16, 2021, 7:32pm UTC](https://forum.ansible.com/t/cant-find-error-in-jinja2-expression/36002/2 "2021-11-16T19:32:49Z")

</div>

> Hi all,
> 
> in a template, I have:
> 
> data\_directory = '{{ {{ i.data }}/{{ postgresql\_version }}/data }}‘
> 
> but I’m getting:  
> &nbsp;&nbsp;"AnsibleError: template error while templating string: expected token ':', got ‚}'
> 
> In the calling ansible block, I have:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;loop:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- '{{ i.data }}/{{ postgresql\_version }}/data/pg\_hba.conf‘
> 
> What am I doing wrong?

Hello Axel,

you certainly can't nest the curly braces.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Axel\_Rau](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@Axel\_Rau](https://forum.ansible.com/u/Axel_Rau)\
**Post date:** [November 17, 2021, 10:05am UTC](https://forum.ansible.com/t/cant-find-error-in-jinja2-expression/36002/3 "2021-11-17T10:05:39Z")

</div>

Oh yes, you are right. (-:

Thanks, Axel
