Hi,
I just want to confirm the behavior of "with_nested" before to submit a pull request.
If I add another element to the loop_nested example like this:
---
# this is a trivial example of how to do a nested loop.
- hosts: all
tasks:
- shell: echo "nested test a={{ item[0] }} b={{ item[1] }} c={{ item[2] }} d={{ item[3] }}"
with_nested:
- [ 'red', 'blue' ]
- [ 1, 2 ]
- [ 'up', 'down']
- [ 'top', 'bottom']
Should the ouput be :
$ ansible-playbook -i hosts loop.yml
...
TASK: [shell echo "nested test a={{item[0]}} b={{item[1]}} c={{item[2]}} d={{item[3]}}"] ***
changed: [localhost] => (item=[['red', 1], 'up', 'top'])
changed: [localhost] => (item=[['red', 1], 'up', 'bottom'])
changed: [localhost] => (item=[['red', 1], 'down', 'top'])
changed: [localhost] => (item=[['red', 1], 'down', 'bottom'])
changed: [localhost] => (item=[['red', 2], 'up', 'top'])
changed: [localhost] => (item=[['red', 2], 'up', 'bottom'])
changed: [localhost] => (item=[['red', 2], 'down', 'top'])
changed: [localhost] => (item=[['red', 2], 'down', 'bottom'])
changed: [localhost] => (item=[['blue', 1], 'up', 'top'])
changed: [localhost] => (item=[['blue', 1], 'up', 'bottom'])
changed: [localhost] => (item=[['blue', 1], 'down', 'top'])
changed: [localhost] => (item=[['blue', 1], 'down', 'bottom'])
changed: [localhost] => (item=[['blue', 2], 'up', 'top'])
changed: [localhost] => (item=[['blue', 2], 'up', 'bottom'])
changed: [localhost] => (item=[['blue', 2], 'down', 'top'])
changed: [localhost] => (item=[['blue', 2], 'down', 'bottom'])
or
TASK: [shell echo "nested test a={{item[0]}} b={{item[1]}} c={{item[2]}} d={{item[3]}}"] ***
changed: [localhost] => (item=['red', 1, 'up', 'top'])
changed: [localhost] => (item=['red', 1, 'up', 'bottom'])
changed: [localhost] => (item=['red', 1, 'down', 'top'])
changed: [localhost] => (item=['red', 1, 'down', 'bottom'])
changed: [localhost] => (item=['red', 2, 'up', 'top'])
changed: [localhost] => (item=['red', 2, 'up', 'bottom'])
changed: [localhost] => (item=['red', 2, 'down', 'top'])
changed: [localhost] => (item=['red', 2, 'down', 'bottom'])
changed: [localhost] => (item=['blue', 1, 'up', 'top'])
changed: [localhost] => (item=['blue', 1, 'up', 'bottom'])
changed: [localhost] => (item=['blue', 1, 'down', 'top'])
changed: [localhost] => (item=['blue', 1, 'down', 'bottom'])
changed: [localhost] => (item=['blue', 2, 'up', 'top'])
changed: [localhost] => (item=['blue', 2, 'up', 'bottom'])
changed: [localhost] => (item=['blue', 2, 'down', 'top'])
changed: [localhost] => (item=['blue', 2, 'down', 'bottom'])
Note in the second case, each element is a flatten list.
Thanks in advance.
Best regards,
Vincent