Previously it was ok to do this in a playbook using Jinja2:
{{ some_var }}
Though we always tried to do
$some_var
And you had to do {{ }} to get at nested variables and things.
Like
{{ ansible_eth0["ipv4"]["address"] }}
Though that's ugly, SO….. (DRUMROLL)
It is now possible to do
${ansible_eth0.ipv4.address}
which is better.
I don't think it groks array indexes yet though… (FIXME?)
And because of which, we're removing the ability to use {{ }} in anything EXCEPT the template module, because this is Jinja2, it's a giant sledgehammer
that we invoke 15+ times per task, and it's slow, and people shouldn't have to know Jinja2, and many people don't know they are using it and there are cases where Jinja2 evaluates once and early and that causes problems. How's that for a run-on sentence, eh?
NOTE -- I believe the presently pushed patch to master allows the long form traversal without the { }, which needs some tweaks or it will break some people's usage of vars files, so I'm reviewing that just to make sure. Testing and tweaking welcome. I suspect some minor tweaks may be required to make this robust.
Ex:
assuming foo=5
$foo.x
should evaluate to
5.x
and not try to index
foo["5"]
or rather, it could try, but it should realize foo is not a hash and stop. I need to validate this. It might be fine.
Thanks to John Kleint for the excellent patch, complete with extensive tests!
--Michael