Variable interpolation problem in playbook

I have the following playbook:

----------- start --------------

Launches a CF stack and provisions the instance as the specified role

So it’s hard to tell anything from this example as we haven’t seen all of the files referenced. Could just be a typo somewhere. I do recommend that people try 1.3, you can enable undefined variable warnings in ansible.cfg, which will soon be the default.

I also highly recommend standarding on new style variable syntax and dropping the legacy form, which is required to use that variable detection.

{{ foo }}

I can in fact work around this by only adding the new hosts to a single host group and passing that through as ‘hosts’, but if it’s a bug, it’s still worth fixing.

The important part is that in the debug message, $role is interpolated:

debug msg=“tag_Name_webserver”

but when it passes it through to the included playbook via “hosts=tag_Name_$role:&tag_env_$env” only $env is interpolated, and $role just becomes the string ‘role’.

I’m running against devel btw.

Also, what are the benefits of $var vs {{ var }}? The docs don’t seem to make much of a distinction.

The docs don’t even mention ${old_stuff} anymore at all, which is why they don’t make a distinction, but I suspect you have confused the legacy parser.

I’ll help with questions on new style variables but not old style ones anymore.

Main thing is getting nested data out of the old form is completely impossible, whereas using Jinja2 inline is much more powerful.

The docs don’t even mention ${old_stuff} anymore at all, which is why they don’t make a distinction, but I suspect you have confused the legacy parser.

http://www.ansibleworks.com/docs/playbooks.html#vars-section refers to ${varname}. I’ll see whether changing to {{ var }} helps.

I’ll file a doc ticket to make it clear ${var} is less recommended.

Thanks!