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