# Double quotes in a host variable

**URL:** <https://forum.ansible.com/t/double-quotes-in-a-host-variable/15520>\
**Category:** Ansible Project\
**Created:** [June 22, 2014, 12:54am UTC](https://forum.ansible.com/t/double-quotes-in-a-host-variable/15520 "2014-06-22T00:54:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harsh\_Jha](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@Harsh\_Jha](https://forum.ansible.com/u/Harsh_Jha)\
**Post date:** [June 22, 2014, 12:54am UTC](https://forum.ansible.com/t/double-quotes-in-a-host-variable/15520/1 "2014-06-22T00:54:44Z")

</div>

My host inventory has a host specific variable and it looks as follows -

**_[local]_**  
**_localhost_**

**_[server\_nodes]_**  
**_[abcd.compute-1.amazonaws.com](http://abcd.compute-1.amazonaws.com)_**

**_[client\_nodes]_**  
**_[xyz.compute-1.amazonaws.com](http://xyz.compute-1.amazonaws.com) subs=“["elasticsearch\_nodes"]”_**  
**_[ghi.compute-1.amazonaws.com](http://ghi.compute-1.amazonaws.com) subs=“["elasticsearch\_nodes"]”_**  
**_[jkl.compute-1.amazonaws.com](http://jkl.compute-1.amazonaws.com) subs=‘[“nginx\_nodes”]’_**

I’m talking about the “subs” variable here. I have tried using it in three different ways as shown above but none of them solves my purpose. Actually I want to keep double quotes. So if I put the following in a template file -

var1 = {{ subs }}

It should get converted to -

var1 = [“nginx\_nodes”]

instead it gets converted to -

var1 = [‘nginx\_nodes’]

I want to keep double quotes and avoid getting them converted to single quotes. Please provide some suggestions. Thanks.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [June 22, 2014, 4:06pm UTC](https://forum.ansible.com/t/double-quotes-in-a-host-variable/15520/2 "2014-06-22T16:06:40Z")

</div>

It’s much easier to put variables in host\_vars/ or group\_vars/ directories instead, which is something I’d consider doing.

If you want to define structured variables, like you seem to be doing above, you’ll want this.

otherwise you’re defining strings, which I don’t think you want.
