Fix nested loop for more than 3 elements

- combine flatten list for each nested level instead once at the end
This commit is contained in:
Vincent Hardion 2013-07-24 14:10:15 +02:00
parent d1effecb2e
commit 09ef7751e1
2 changed files with 10 additions and 1 deletions

View file

@ -34,7 +34,7 @@ def combine(a,b):
results = []
for x in a:
for y in b:
results.append([x,y])
results.append(flatten([x,y]))
return results
class LookupModule(object):

View file

@ -56,6 +56,15 @@
- name: cleanup test file
action: file path=/tmp/ansible-test-with_lines-data state=absent
# Test nested loop
- name: test nested loop with more than 3 elements
command: test "{{ item[0] }}, {{ item[1] }}, {{ item[2] }}, {{ item[3] }}" = "red, 1, up, top"
with_nested:
- [ 'red' ]
- [ 1 ]
- [ 'up']
- [ 'top']
# password lookup plugin
- name: ensure test file doesn't exist
# command because file will return differently