On 29/09/16 03:53, E.C. Raymond wrote:
> I am testing on both 1.9.4 and 2.1 and seeing the exact same behavior.
>
> We have a fact.d generator that creates a tree of facts under
> ansible_local. We use this to set defaults, but if during playbook
> execution it needs to update a default, it clobbers the entire
> ansible_local parent fact. I created a test playbook to replicate the
> same issue.
I'm no authority, for instance I've not switched to using 2.x versions
of Ansible since I got an essentially functional setup, but I'll chip in
and say I *think* this is normal behaviour when variable scopes are
composed.
I used to try and nest role variables into hierarchies but a long time
ago decided this was simply too fraught when composing them (and this
not even using set_fact). I started treating them as globals (albeit
"with structure"), and naming them with prefixes accordingly: replace
underscores for dots. This resolved my problems at the time.
If it wasn't or is no longer the case, I'd be interested to hear about
it, I'm not aware of anything in the docs which describe scope
composition rules in this level of detail.
N