Debian Codegraph @

test/integration/targets/ansible-inventory/tasks/main.yml

raw symbols SCIP
1 - name: "No command supplied"
2 command: ansible-inventory
3 ignore_errors: true
4 register: result
5
6 - assert:
7 that:
8 - result is failed
9 - result.stderr is contains "No action selected, at least one of --host, --graph or --list needs to be specified."
10
11 - name: "test option: --list --export"
12 command: ansible-inventory --list --export
13 register: result
14
15 - assert:
16 that:
17 - result is succeeded
18
19 - name: "test option: --list --yaml --export"
20 command: ansible-inventory --list --yaml --export
21 register: result
22
23 - assert:
24 that:
25 - result is succeeded
26
27 - name: "test option: --list --output"
28 command: ansible-inventory --list --output junk.txt
29 register: result
30
31 - name: stat output file
32 stat:
33 path: junk.txt
34 register: st
35
36 - assert:
37 that:
38 - result is succeeded
39 - st.stat.exists
40
41 - name: "test option: --graph"
42 command: ansible-inventory --graph
43 register: result
44
45 - assert:
46 that:
47 - result is succeeded
48
49 - name: "test option: --graph --vars"
50 command: ansible-inventory --graph --vars
51 register: result
52
53 - assert:
54 that:
55 - result is succeeded
56
57 - name: "test option: --graph with bad pattern"
58 command: ansible-inventory --graph invalid
59 ignore_errors: true
60 register: result
61
62 - assert:
63 that:
64 - result is failed
65 - result.stderr is contains "Pattern must be valid group name when using --graph"
66
67 - name: "test option: --host localhost"
68 command: ansible-inventory --host localhost
69 register: result
70
71 - assert:
72 that:
73 - result is succeeded
74
75 - name: "test option: --host with invalid host"
76 command: ansible-inventory --host invalid
77 ignore_errors: true
78 register: result
79
80 - assert:
81 that:
82 - result is failed
83 - |
84 result.stderr is contains "Could not match supplied host pattern, ignoring: invalid"
85
86 - name: "test json output with unicode characters"
87 command: ansible-inventory --list -i {{ role_path }}/files/unicode.yml
88 register: result
89
90 - assert:
91 that:
92 - result is succeeded
93 - result.stdout is contains('příbor')
94
95 - block:
96 - name: "test json output file with unicode characters"
97 command: ansible-inventory --list --output unicode_inventory.json -i {{ role_path }}/files/unicode.yml
98
99 - set_fact:
100 json_inventory_file: "{{ lookup('file', 'unicode_inventory.json') }}"
101
102 - assert:
103 that:
104 - json_inventory_file|string is contains('příbor')
105 always:
106 - file:
107 name: unicode_inventory.json
108 state: absent
109
110 - name: "test yaml output with unicode characters"
111 command: ansible-inventory --list --yaml -i {{ role_path }}/files/unicode.yml
112 register: result
113
114 - assert:
115 that:
116 - result is succeeded
117 - result.stdout is contains('příbor')
118
119 - block:
120 - name: "test yaml output file with unicode characters"
121 command: ansible-inventory --list --yaml --output unicode_inventory.yaml -i {{ role_path }}/files/unicode.yml
122
123 - set_fact:
124 yaml_inventory_file: "{{ lookup('file', 'unicode_inventory.yaml') | string }}"
125
126 - assert:
127 that:
128 - yaml_inventory_file is contains('příbor')
129 always:
130 - file:
131 name: unicode_inventory.yaml
132 state: absent
133
134 - include_tasks: toml.yml
135
136 - include_tasks: "{{item}}_output.yml"
137 loop:
138 - json
139 - yaml
140 - toml