Double quotes in a host variable

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

[local]
localhost

[server_nodes]
abcd.compute-1.amazonaws.com

[client_nodes]
xyz.compute-1.amazonaws.com subs=“["elasticsearch_nodes"]”
ghi.compute-1.amazonaws.com subs=“["elasticsearch_nodes"]”
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.

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.