problem with expanditg variables in a template

Hi,

I have a problem provisionning my /etc/hosts files : it seems to me that variables are not expanded, and it used to work previously.
I am using ansible 1.7.2.

My host.j2 looks like this:
127.0.0.1 localhost
127.0.1.1 {{ inventory_hostname }}
{% if “frontservers” in group_names or “lbservers” in group_names %}
{% for host in [“{{ site_one }}”, “{{ site_two }}”, “{{ site_three }}”]%}
127.0.1.1 {{ host }}
{% endfor %}
{% endif %}

My sever file looks like this:
[frontservers]
some-server-01.xxx.com
some-server-02.xxx.com

[all:vars]
site_one=someurl-01.xxx.com
site_two=someurl-02.xxx.com
site_three=someurl-03.xxx.com

Expected result on some-server-01.xxx.com for instance:
127.0.0.1 localhost
127.0.1.1 some-server-01.xxx.com
127.0.1.1 someurl-01.xxx.com
127.0.1.1 someurl-02.xxx.com
127.0.1.1 someurl-03.xxx.com

Actual result on some-server-01.xxx.com:
127.0.0.1 localhost
127.0.1.1 some-server-01.xxx.com
127.0.1.1 {{ site_one }}
127.0.1.1 {{ site_two }}
127.0.1.1 {{ site_three }}

What’s wrong ?
How come it stopped working ?

I tried using simple quotes, double quotes in my template file, but the result is the same.

Thanks

too many mustaches, you don't need them in:

{% for host in ["{{ site_one }}", "{{ site_two }}", "{{ site_three }}"]%}

do it this way:

{% for host in [ site_one, site_two, site_three] %}

Thanks this worked very well !

How come my previous version with "many mustaches" stopped working
suddenly ?

I'm not sure how it worked in the first place, this is pure jinja2

I'm not sure how it worked in the first place, this is pure jinja2

It worked very fine until recently, and I have been using this playbook
like this for almost a year on my production servers.
It doesn't matter anyway, since we have a working (and lighter) solution.

Thanks again.