Hi All,
I raised this potential bug:
https://github.com/ansible/ansible/issues/14325
which has been closed as being a current known limitation, together with a referral to the relevant docs (http://docs.ansible.com/ansible/playbooks_loops.html#loops-and-includes)
Thing is, my comprehension of the docs supports my expectation of how the example code provided in the bug should work, and contradicts the results I actually see (granted, the docs do not specifically deal with a looped include task, nested within another).
The docs say:
In 2.0 you are able to use loops and task includes (but not playbook includes), this adds the ability to loop over the set of tasks in one shot. There are a couple of things that you need to keep in mind, a included task that has it’s own loop will overwrite the value of the special variable. So if you want access to both the include’s and the current task’s you should use to create a alias to the outer one.
To my mind, this means that as you descend through nested task includes that are each passed their own list to iterate over, each included file should see the ‘item’ variable overwritten within their context. This is not what I am seeing happening, and am instead seeing the ‘item’ variable set to the value passed to the outer most include and then never being overwritten for the inner includes.
Could anybody take a look and see if you think I am reading it wrong, or is the bug I raised legitimate?