blob: e3d9e4354199d670bfd9267909003cc11aa19cf6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
---
- hosts: all
gather_facts: no
tasks:
- name: test magic vars for hosts without any failed/unreachable (no serial)
assert:
that:
- ansible_play_batch | length == 3
- ansible_play_hosts | length == 3
- ansible_play_hosts_all | length == 3
run_once: True
- ping:
failed_when: "inventory_hostname == 'failed'"
- meta: clear_host_errors
- hosts: all
gather_facts: no
tasks:
- name: test host errors were cleared
assert:
that:
- ansible_play_batch | length == 3
- ansible_play_hosts | length == 3
- ansible_play_hosts_all | length == 3
run_once: True
- ping:
failed_when: "inventory_hostname == 'failed'"
- name: test magic vars exclude failed/unreachable hosts
assert:
that:
- ansible_play_batch | length == 1
- ansible_play_hosts | length == 1
- "ansible_play_batch == ['successful']"
- "ansible_play_hosts == ['successful']"
- ansible_play_hosts_all | length == 3
run_once: True
- hosts: all
gather_facts: no
tasks:
- name: test failed/unreachable persists between plays
assert:
that:
- ansible_play_batch | length == 1
- ansible_play_hosts | length == 1
- "ansible_play_batch == ['successful']"
- "ansible_play_hosts == ['successful']"
- ansible_play_hosts_all | length == 3
run_once: True
|