Debian Codegraph @

test/integration/targets/order/order.yml

raw
1 - name: just plain order
2 hosts: all
3 gather_facts: false
4 order: '{{ myorder | default("inventory") }}'
5 tasks:
6 - shell: "echo '{{ inventory_hostname }}' >> hostlist.txt"
7
8 - name: with serial
9 hosts: all
10 gather_facts: false
11 serial: 1
12 order: '{{ myorder | default("inventory")}}'
13 tasks:
14 - shell: "echo '{{ inventory_hostname }}' >> shostlist.txt"
15
16 - name: ensure everything works
17 hosts: localhost
18 gather_facts: false
19 tasks:
20 - assert:
21 that:
22 - item.1 == hostlist[item.0]
23 - item.1 == shostlist[item.0]
24 loop: '{{ lookup("indexed_items", inputlist) }}'
25 vars:
26 hostlist: '{{ lookup("file", "hostlist.txt").splitlines() }}'
27 shostlist: '{{ lookup("file", "shostlist.txt").splitlines() }}'
28 when: myorder | default('inventory') != 'shuffle'
29
30 - name: Assert that shuffle worked
31 assert:
32 that:
33 - item.1 != hostlist[item.0] or item.1 in hostlist
34 - item.1 != hostlist[item.0] or item.1 in hostlist
35 loop: '{{ lookup("indexed_items", inputlist) }}'
36 vars:
37 hostlist: '{{ lookup("file", "hostlist.txt").splitlines() }}'
38 shostlist: '{{ lookup("file", "shostlist.txt").splitlines() }}'
39 when: myorder | default('inventory') == 'shuffle'