# YAML variable without using quotes?

**URL:** <https://forum.ansible.com/t/yaml-variable-without-using-quotes/20612>\
**Category:** Ansible Project\
**Created:** [February 18, 2016, 4:33am UTC](https://forum.ansible.com/t/yaml-variable-without-using-quotes/20612 "2016-02-18T04:33:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![RobL](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@RobL](https://forum.ansible.com/u/RobL)\
**Post date:** [February 18, 2016, 4:33am UTC](https://forum.ansible.com/t/yaml-variable-without-using-quotes/20612/1 "2016-02-18T04:33:54Z")

</div>

I’m hitting this error:

> We could be wrong, but this one looks like it might be an issue with
> 
> missing quotes. Always quote template expression brackets when they
> 
> start a value. For instance:
> 
> with\_items:
> 
> - {{ foo }}
> 
> Should be written as:
> 
> with\_items:
> 
> - “{{ foo }}”

The problem is that I’m converting the YAML to JSON, and I need the value (a number) to be unquoted in the JSON.

Is there any way I can avoid this error without quoting, or is there some way to remove the quotes when it’s converted to JSON?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 18, 2016, 4:02pm UTC](https://forum.ansible.com/t/yaml-variable-without-using-quotes/20612/2 "2016-02-18T16:02:54Z")

</div>

“{{foo|int}}” should return a number

---

<div class="post-metadata">

**Author:** ![RobL](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@RobL](https://forum.ansible.com/u/RobL)\
**Post date:** [February 18, 2016, 4:17pm UTC](https://forum.ansible.com/t/yaml-variable-without-using-quotes/20612/3 "2016-02-18T16:17:40Z")

</div>

No, I’m still seeing the value being quoted:

instances: “{{ groups[‘workers’]|count|int }}”  
becomes:  
“instances”: “3”,

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 18, 2016, 4:32pm UTC](https://forum.ansible.com/t/yaml-variable-without-using-quotes/20612/4 "2016-02-18T16:32:14Z")

</div>

what version of ansible?

---

<div class="post-metadata">

**Author:** ![RobL](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@RobL](https://forum.ansible.com/u/RobL)\
**Post date:** [February 18, 2016, 4:54pm UTC](https://forum.ansible.com/t/yaml-variable-without-using-quotes/20612/5 "2016-02-18T16:54:09Z")

</div>

ansible 1.9.0.1

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [February 18, 2016, 4:59pm UTC](https://forum.ansible.com/t/yaml-variable-without-using-quotes/20612/6 "2016-02-18T16:59:27Z")

</div>

that is a bug in that version, it should work on 2.0 and above

---

<div class="post-metadata">

**Author:** ![RobL](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@RobL](https://forum.ansible.com/u/RobL)\
**Post date:** [February 18, 2016, 8:43pm UTC](https://forum.ansible.com/t/yaml-variable-without-using-quotes/20612/7 "2016-02-18T20:43:21Z")

</div>

I’m still seeing the same issue on Ansible 2.0.0.2.

---

<div class="post-metadata">

**Author:** ![RobL](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@RobL](https://forum.ansible.com/u/RobL)\
**Post date:** [February 19, 2016, 6:19pm UTC](https://forum.ansible.com/t/yaml-variable-without-using-quotes/20612/8 "2016-02-19T18:19:59Z")

</div>

Brian, can you point me to the commit that should be fixing this bug?

Thanks!

---

<div class="post-metadata">

**Author:** ![RobL](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@RobL](https://forum.ansible.com/u/RobL)\
**Post date:** [February 24, 2016, 12:17am UTC](https://forum.ansible.com/t/yaml-variable-without-using-quotes/20612/9 "2016-02-24T00:17:52Z")

</div>

I’m still seeing a repro of the bug. Is this the commit you’re referring to?  
[https://github.com/ansible/ansible/pull/10465](https://github.com/ansible/ansible/pull/10465)

For this bug?  
[https://github.com/ansible/ansible/issues/9362](https://github.com/ansible/ansible/issues/9362)
