Hi,
I have two sets of data:
set1 = [ 1, 2 ]
set2 = [ [‘a’,‘b’,‘c’], [‘d’,‘e’] ]
For every element from set1 I need to perform a task with parameters from set2. So I need to perform tasks with following parameters:
task(1,a)
task(1,b)
task(1,c)
task(2,d)
task(2,e)
I can loop over elements of set2 using loop_control:
Outer loop:
- include: subtasks/dwnfiles.yml
with_items: “{{ set2 }}”
loop_control:
loop_var: s2_elements
Inner loop:
- debug:
msg: “inner item={{ item }}”
with_items:
“{{ s2_elements }}”
This works fine, but how can I pass to the inner loop values from set1? Is it possible to use somehow with_together here? Something like that:
Outer loop:
- include: subtasks/dwnfiles.yml
with_together:
“{{ set1 }}”
“{{ set2 }}”
loop_control:
loop_var: s1_element
loop_var: s2_elements
Inner loop:
- debug:
msg: “outer from set1={{ s1_element }} inner item={{ item }}”
with_items:
“{{ s2_elements }}”
Or may be there’s another solution?
Best Regards,
Ivan