also sprach Michael DeHaan <michael@ansibleworks.com> [2013.06.13.1719 +0200]:
Ansible intentionally lacks vars_scoping.
It's all part of the simplicity of things to not have to have
conversations about scoping.
I am really failing to see your "simplicity of things" argument, and
I also doubt that there are really people who *want* *exactly* the
current behaviour, namely:
- roles (i.e. reusable, sharable code) can overwrite variables in
playbooks, and even the ones that are very specific to the
inventory (host_vars, group_vars). This means that using a role
may well break other, completely unrelated parts of my setup;
- role variables themselves can all be overwritten by other roles
and vars_files, not only through parametrised role includes. You
are advocating a soft, "by-convention" remediation that is
functionally equivalent to scoping, but optional and
error-prone;
- roles basically do not have an interface and do not obey any
form of imperative paradigms or closure. It feels a bit like
the re-use you are trying to achieve with roles is equivalent to
giving root access to the developers of tools I want to use;
- there is no way to find out what may be tempering/overwriting my
variables after all variables from all over the place have been
munged in the global namespace according to precedence rules
that do not obey the "most-specific-wins" principle. In fact,
I'd argue that the way variable resolution takes place is
actually almost non-determinstic in the event of multiple,
conflicting defintions;
- role include parametrisation syntax is different from playbook
include parametrisation syntax. The former, requiring me to
enter ascii-representations of data structures feels like a hack
at best;
Who could possibly want all of that?
I recognize that this is different from what some people want, but
at the same time being *exactly* what some people want.
Good software, especially "simple" software, hard-codes no
assumptions; it provides flexible interfaces and leaves all the rest
up to the user.