Debian Codegraph @

test/integration/targets/lookup_together/tasks/main.yml

raw
1 - name: test with_together
2 #shell: echo {{ item }}
3 set_fact: "{{ item.0 }}={{ item.1 }}"
4 with_together:
5 - [ 'a', 'b', 'c', 'd' ]
6 - [ '1', '2', '3', '4' ]
7
8 - name: verify with_together results
9 assert:
10 that:
11 - "a == '1'"
12 - "b == '2'"
13 - "c == '3'"
14 - "d == '4'"
15
16 - block:
17 - name: "EXPECTED FAILURE - test empty list"
18 debug:
19 msg: "{{ item.0 }} and {{ item.1 }}"
20 with_together: []
21
22 - fail:
23 msg: "should not get here"
24
25 rescue:
26 - assert:
27 that:
28 - ansible_failed_task.name == "EXPECTED FAILURE - test empty list"
29 - ansible_failed_result.msg is contains "with_together requires at least one element in each list"