# Use of {{ }} var syntax in with\_nested

**URL:** <https://forum.ansible.com/t/use-of-var-syntax-in-with-nested/13287>\
**Category:** Ansible Project\
**Created:** [August 13, 2013, 12:39am UTC](https://forum.ansible.com/t/use-of-var-syntax-in-with-nested/13287 "2013-08-13T00:39:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jesse\_Keating](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@Jesse\_Keating](https://forum.ansible.com/u/Jesse_Keating)\
**Post date:** [August 13, 2013, 12:39am UTC](https://forum.ansible.com/t/use-of-var-syntax-in-with-nested/13287/1 "2013-08-13T00:39:34Z")

</div>

Is it possible to use the {{ var.stdout\_lines }} syntax in a with\_nested construct?

with\_nested:  
&nbsp;&nbsp;- {{ var.stdout\_lines }}  
&nbsp;&nbsp;- ['some', 'ohter', 'data']

seems to throw an error. However..

with\_nested:  
&nbsp;&nbsp;- ${var.stdout\_lines}  
&nbsp;&nbsp;- ['some', 'other', 'data']

seems to work.

and

with\_nested:  
&nbsp;&nbsp;- var.stdout\_lines  
&nbsp;&nbsp;- ['some', 'other', 'data']

tries to use "var.stdout\_lines" as a literal list of chars, 'v', 'a', 'r', '.', …

and

with\_nested:  
&nbsp;&nbsp;- "{{ var.stdout\_lines }}"  
&nbsp;&nbsp;- ['some', 'other', 'data']

treats the big full string of the expanded list as a string of chars, including the brackets.

- var['stdout\_lines'] is just a string too.

So, I'm confused!

-jlk

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [August 13, 2013, 8:24pm UTC](https://forum.ansible.com/t/use-of-var-syntax-in-with-nested/13287/2 "2013-08-13T20:24:55Z")

</div>

Are you using 1.3?

1.3 is much nicer about this, and will know what you mean in with\_nested.

The bare form is correct.

with\_nested:

- var.stdout\_lines
- [‘some’, ‘other’, ‘data’]

Only use {{ foo }} when you want a string, always!

---

<div class="post-metadata">

**Author:** ![Jesse\_Keating](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@Jesse\_Keating](https://forum.ansible.com/u/Jesse_Keating)\
**Post date:** [August 13, 2013, 8:28pm UTC](https://forum.ansible.com/t/use-of-var-syntax-in-with-nested/13287/3 "2013-08-13T20:28:02Z")

</div>

We aren't on 1.3 yet, so I'll mark that routine as being able to go away when we make the move. Thanks!

-jlk
