Help needed: Please explain basic concept about variables syntax.

Hi,
I’m new to using ansible and I’ve seen several way to use/reference/define variables and I’m not sure when to use these notations.

I’ve seen variables such as:

$variable_name
${variable_name}
{{ variable_name }}

This is very confusing for a first time user and I haven’t found why/when using these various syntaxes.

Could you please explain me ?

Best regards,
F.R.

​It is really easy:​

​Never, ever use these two syntaxes:

$variable_name

${variable_name}

They are old, deprecated, and not supported!

Only use this one:
​​

{{ variable_name }}

​See also
http://www.ansibleworks.com/docs/playbooks_variables.html#using-variables-about-jinja2

You'll notice that only the one true syntax is mentioned :)​

Serge

Hi Serge,

thank you very much.

In fact I’ve seen jinja2 mentionned on the website but when I find sample playbook on the web with explanations they are using old syntax.
I’ll convert them.

F.R.

Yeah I unfortunately can’t do anything about old blog posts.

For Ansible 1.4, it will warn you about deprecation issues, so I think this question will quickly self-resolve as more people adopt 1.4.