Locality of reference: override semantics for ansible 1.9.2 are wrong (IMHO)

Just came across a really hard bug to track down. The code in question looked, essentially, like this:

[[[

  • include: some_file.yml
    vars:
    x: 1
    ]]]

The problem here was that some_file.yml was not being invoked with x set to 1. The reason for this was that another included playbook had done the following:

[[[

  • set_fact:
    x: 2
    ]]]

As you might imagine, this behaviour leads to bugs that are almost impossible to track down: one cannot examine an include and know for certain the variables that will be passed into the included task.

I’ve raised a bug on this but I’d appreciate feedback about whether this really is broken by accident: I find it hard to believe that anyone’s depending on the current behaviour.

https://github.com/ansible/ansible/issues/12277

Cheers,
jan