|
56 | 56 | when: |
57 | 57 | - is_fstests|bool |
58 | 58 |
|
59 | | -- name: Generate the Ansible hosts file for a Linux kernel build |
60 | | - tags: ["hosts"] |
61 | | - ansible.builtin.template: |
62 | | - src: "{{ kdevops_hosts_template }}" |
63 | | - dest: "{{ ansible_cfg_inventory }}" |
64 | | - force: true |
65 | | - trim_blocks: true |
66 | | - lstrip_blocks: true |
67 | | - when: |
68 | | - - bootlinux_builder |
69 | | - - ansible_hosts_template.stat.exists |
70 | | - |
71 | | -- name: Generate the Ansible inventory file |
72 | | - tags: ["hosts"] |
73 | | - ansible.builtin.template: |
74 | | - src: "{{ kdevops_hosts_template }}" |
75 | | - dest: "{{ ansible_cfg_inventory }}" |
76 | | - force: true |
77 | | - trim_blocks: true |
78 | | - lstrip_blocks: true |
79 | | - when: |
80 | | - - not kdevops_workflows_dedicated_workflow |
81 | | - - ansible_hosts_template.stat.exists |
82 | | - - not kdevops_enable_nixos|default(false)|bool |
83 | | - |
84 | | -- name: Generate the Ansible inventory file for NixOS |
85 | | - tags: ['hosts'] |
86 | | - ansible.builtin.template: |
87 | | - src: "{{ kdevops_hosts_template }}" |
88 | | - dest: "{{ ansible_cfg_inventory }}" |
89 | | - force: true |
90 | | - trim_blocks: True |
91 | | - lstrip_blocks: True |
92 | | - when: |
93 | | - - not kdevops_workflows_dedicated_workflow |
94 | | - - ansible_hosts_template.stat.exists |
95 | | - - kdevops_enable_nixos|default(false)|bool |
96 | | - |
97 | | -- name: Update Ansible inventory access modification time so make sees it updated |
98 | | - ansible.builtin.file: |
99 | | - path: "{{ ansible_cfg_inventory }}" |
100 | | - state: touch |
101 | | - mode: "0755" |
102 | | - |
103 | | -- name: Generate the Ansible inventory file for dedicated cxl work |
104 | | - tags: ["hosts"] |
105 | | - ansible.builtin.template: |
106 | | - src: "{{ kdevops_hosts_template }}" |
107 | | - dest: "{{ anisble_cfg_inventory }}" |
108 | | - force: true |
109 | | - trim_blocks: true |
110 | | - lstrip_blocks: true |
111 | | - when: |
112 | | - - kdevops_workflows_dedicated_workflow |
113 | | - - kdevops_workflow_enable_cxl |
114 | | - - ansible_hosts_template.stat.exists |
115 | | - |
116 | | -- name: Generate the Ansible inventory file for dedicated pynfs work |
117 | | - tags: ["hosts"] |
118 | | - ansible.builtin.template: |
119 | | - src: "{{ kdevops_hosts_template }}" |
120 | | - dest: "{{ ansible_cfg_inventory }}" |
121 | | - force: true |
122 | | - trim_blocks: true |
123 | | - lstrip_blocks: true |
124 | | - when: |
125 | | - - kdevops_workflows_dedicated_workflow |
126 | | - - kdevops_workflow_enable_pynfs |
127 | | - - ansible_hosts_template.stat.exists |
128 | | - |
129 | | -- name: Generate the Ansible inventory file for dedicated gitr workflow |
130 | | - tags: ["hosts"] |
131 | | - vars: |
132 | | - gitr_enabled_hosts: "{{ gitr_enabled_test_groups | ansible.builtin.split }}" |
133 | | - ansible.builtin.template: |
134 | | - src: "{{ kdevops_hosts_template }}" |
135 | | - dest: "{{ ansible_cfg_inventory }}" |
136 | | - force: true |
137 | | - trim_blocks: true |
138 | | - lstrip_blocks: true |
139 | | - when: |
140 | | - - kdevops_workflows_dedicated_workflow |
141 | | - - kdevops_workflow_enable_gitr |
142 | | - - ansible_hosts_template.stat.exists |
143 | | - |
144 | | -- name: Generate an Ansible inventory file for a dedicated ltp workflow |
| 59 | +- name: Infer enabled fstests test section types |
145 | 60 | tags: ["hosts"] |
146 | | - vars: |
147 | | - ltp_enabled_hosts: "{{ ltp_enabled_test_groups | ansible.builtin.split }}" |
148 | | - ansible.builtin.template: |
149 | | - src: "{{ kdevops_hosts_template }}" |
150 | | - dest: "{{ ansible_cfg_inventory }}" |
151 | | - force: true |
152 | | - trim_blocks: true |
153 | | - lstrip_blocks: true |
154 | | - when: |
155 | | - - kdevops_workflows_dedicated_workflow |
156 | | - - kdevops_workflow_enable_ltp |
157 | | - - ansible_hosts_template.stat.exists |
158 | | - |
159 | | -- name: Generate the Ansible inventory file for dedicated nfstest workflow |
160 | | - tags: ["hosts"] |
161 | | - vars: |
162 | | - nfstest_enabled_hosts: "{{ nfstest_enabled_test_groups | ansible.builtin.split }}" |
163 | | - ansible.builtin.template: |
164 | | - src: "{{ kdevops_hosts_template }}" |
165 | | - dest: "{{ ansible_cfg_inventory }}" |
166 | | - force: true |
167 | | - trim_blocks: true |
168 | | - lstrip_blocks: true |
169 | | - when: |
170 | | - - kdevops_workflows_dedicated_workflow |
171 | | - - kdevops_workflow_enable_nfstest |
172 | | - - ansible_hosts_template.stat.exists |
173 | | - |
174 | | -- name: Set empty enabled test types list for fstests |
175 | | - tags: ["hosts"] |
176 | | - ansible.builtin.set_fact: |
177 | | - fstests_enabled_test_types: [] |
178 | | - when: |
179 | | - - is_fstests |
180 | | - - ansible_hosts_template.stat.exists |
181 | | - |
182 | | -- name: Check which fstests test types are enabled |
183 | | - register: fstests_enabled_test_types_reg |
184 | 61 | vars: |
185 | 62 | fs: "{{ fstests_fstyp | upper }}" |
186 | | - config_val: "{{ 'CONFIG_FSTESTS_' + fs + '_SECTION_' }}" |
187 | | - fs_config_data: "{{ lookup('file', fs_config_path) }}" |
188 | | - sections_without_default: "{{ fs_config_data | regex_replace('\\[default\\]', multiline=True) }}" |
189 | | - sections_without_default_and_nfsd: "{{ sections_without_default | regex_replace('\\[nfsd\\]', multiline=True) }}" |
190 | | - sections_lines: "{{ sections_without_default_and_nfsd | regex_findall('^\\[(.*)', multiline=True) }}" |
191 | | - clean_section_lines: "{{ sections_lines | regex_replace('\\[') | regex_replace('\\]') }}" |
192 | | - clean_section_lines_without_fsname: "{{ clean_section_lines | regex_replace(fstests_fstyp + '_') }}" |
193 | | - config_sections_targets: "{{ clean_section_lines_without_fsname | replace(\"'\", '') | split(', ') }}" |
194 | | - ansible.builtin.lineinfile: |
195 | | - path: "{{ topdir_path }}/.config" |
196 | | - regexp: "^({{ config_val + item.upper() }})=y" |
197 | | - line: "" |
198 | | - check_mode: true |
199 | | - with_items: "{{ config_sections_targets }}" |
200 | | - loop_control: |
201 | | - label: "Checking for {{ config_val + item.upper() }}" |
202 | | - when: |
203 | | - - is_fstests |
204 | | - - ansible_hosts_template.stat.exists |
205 | | - |
206 | | -- name: Now expand the list of enabled fstests for valid configuration sections |
207 | | - tags: ["hosts"] |
| 63 | + config_prefix: "{{ 'CONFIG_FSTESTS_' + fs + '_SECTION_' }}" |
208 | 64 | ansible.builtin.set_fact: |
209 | | - fstests_enabled_test_types: "{{ fstests_enabled_test_types + [fstests_fstyp + '-' + item.item | regex_replace('_', '-')] }}" |
210 | | - with_items: "{{ fstests_enabled_test_types_reg.results }}" |
211 | | - loop_control: |
212 | | - label: "Checking for {{ item.item }} " |
213 | | - when: |
214 | | - - is_fstests |
215 | | - - ansible_hosts_template.stat.exists |
216 | | - - item.changed |
217 | | - |
218 | | -- name: Generate the Ansible inventory file for a dedicated fstests setup |
219 | | - tags: ["hosts"] |
220 | | - vars: |
221 | | - fs_config_data: "{{ lookup('file', fs_config_path) }}" |
222 | | - sections_without_default: "{{ fs_config_data | regex_replace('\\[default\\]', multiline=True) }}" |
223 | | - sections_lines: "{{ sections_without_default | regex_findall('^\\[(.*)', multiline=True) }}" |
224 | | - clean_section_lines: "{{ sections_lines | regex_replace('\\[') | regex_replace('\\]') }}" |
225 | | - sections_replace_underscore: "{{ clean_section_lines | replace('_', '-') }}" |
226 | | - sections: "{{ sections_replace_underscore | replace(\"'\", '') | split(', ') }}" |
227 | | - ansible.builtin.template: |
228 | | - src: "{{ kdevops_hosts_template }}" |
229 | | - dest: "{{ ansible_cfg_inventory }}" |
230 | | - force: true |
231 | | - trim_blocks: true |
232 | | - lstrip_blocks: true |
| 65 | + fstests_enabled_test_types: >- |
| 66 | + {{ |
| 67 | + lookup('file', topdir_path + '/.config') |
| 68 | + | regex_findall('^' + config_prefix + '(.*)=y$', multiline=True) |
| 69 | + | reject('match', '.*_ENABLED$') |
| 70 | + | map('lower') |
| 71 | + | map('regex_replace', '_', '-') |
| 72 | + | map('regex_replace', '^', fstests_fstyp + '-') |
| 73 | + | list |
| 74 | + }} |
233 | 75 | when: |
234 | 76 | - is_fstests |
235 | 77 | - ansible_hosts_template.stat.exists |
|
257 | 99 | - kdevops_workflow_enable_blktests |
258 | 100 | - ansible_hosts_template.stat.exists |
259 | 101 |
|
260 | | -- name: Generate the Ansible inventory file for a dedicated blktests setup |
261 | | - tags: ["hosts"] |
262 | | - ansible.builtin.template: |
263 | | - src: "{{ kdevops_hosts_template }}" |
264 | | - dest: "{{ ansible_cfg_inventory }}" |
265 | | - force: true |
266 | | - trim_blocks: true |
267 | | - lstrip_blocks: true |
268 | | - when: |
269 | | - - kdevops_workflows_dedicated_workflow |
270 | | - - kdevops_workflow_enable_blktests |
271 | | - - ansible_hosts_template.stat.exists |
272 | | - |
273 | 102 | - name: Infer enabled selftests test section types |
274 | 103 | ansible.builtin.set_fact: |
275 | 104 | selftests_enabled_test_types: >- |
|
284 | 113 | - kdevops_workflow_enable_selftests |
285 | 114 | - ansible_hosts_template.stat.exists |
286 | 115 |
|
287 | | -- name: Generate the Ansible inventory file for a dedicated selftests setup |
288 | | - tags: ["hosts"] |
289 | | - ansible.builtin.template: |
290 | | - src: "{{ kdevops_hosts_template }}" |
291 | | - dest: "{{ ansible_cfg_inventory }}" |
292 | | - force: true |
293 | | - trim_blocks: true |
294 | | - lstrip_blocks: true |
295 | | - when: |
296 | | - - kdevops_workflows_dedicated_workflow |
297 | | - - kdevops_workflow_enable_selftests |
298 | | - - ansible_hosts_template.stat.exists |
299 | | - |
300 | 116 | - name: Collect dynamically supported filesystems |
301 | 117 | vars: |
302 | 118 | supported_filesystems_variables: "{{ hostvars[inventory_hostname] | dict2items | selectattr('key', 'search', '^sysbench_supported_filesystem_') }}" |
|
326 | 142 | - kdevops_workflows_dedicated_workflow |
327 | 143 | - kdevops_workflow_enable_sysbench |
328 | 144 |
|
329 | | -- name: Generate the Ansible inventory file for a dedicated sysbench setup |
330 | | - tags: ["hosts"] |
331 | | - ansible.builtin.template: |
332 | | - src: "{{ kdevops_hosts_template }}" |
333 | | - dest: "{{ ansible_cfg_inventory }}" |
334 | | - force: true |
335 | | - trim_blocks: true |
336 | | - lstrip_blocks: true |
337 | | - when: |
338 | | - - kdevops_workflows_dedicated_workflow |
339 | | - - kdevops_workflow_enable_sysbench |
340 | | - - ansible_hosts_template.stat.exists |
341 | | - |
342 | | - |
343 | | -- name: Generate the Ansible hosts file for a dedicated fio-tests setup |
344 | | - tags: ["hosts"] |
345 | | - ansible.builtin.template: |
346 | | - src: "{{ kdevops_hosts_template }}" |
347 | | - dest: "{{ ansible_cfg_inventory }}" |
348 | | - force: true |
349 | | - trim_blocks: true |
350 | | - lstrip_blocks: true |
351 | | - mode: "0644" |
352 | | - when: |
353 | | - - kdevops_workflows_dedicated_workflow |
354 | | - - kdevops_workflow_enable_fio_tests |
355 | | - - ansible_hosts_template.stat.exists |
356 | | - - not kdevops_enable_nixos|default(false)|bool |
357 | | - |
358 | | - |
359 | 145 | - name: Infer enabled mmtests test types |
360 | 146 | ansible.builtin.set_fact: |
361 | 147 | mmtests_enabled_test_types: >- |
|
370 | 156 | - kdevops_workflow_enable_mmtests |
371 | 157 | - ansible_hosts_template.stat.exists |
372 | 158 |
|
373 | | -- name: Generate the Ansible hosts file for a dedicated mmtests setup |
374 | | - tags: ["hosts"] |
375 | | - ansible.builtin.template: |
376 | | - src: "{{ kdevops_hosts_template }}" |
377 | | - dest: "{{ ansible_cfg_inventory }}" |
378 | | - force: true |
379 | | - trim_blocks: true |
380 | | - lstrip_blocks: true |
381 | | - when: |
382 | | - - kdevops_workflows_dedicated_workflow |
383 | | - - kdevops_workflow_enable_mmtests |
384 | | - - ansible_hosts_template.stat.exists |
385 | | - |
386 | | -- name: Generate the Ansible hosts file for a dedicated reboot-limit setup |
387 | | - tags: ["hosts"] |
388 | | - ansible.builtin.template: |
389 | | - src: "{{ kdevops_hosts_template }}" |
390 | | - dest: "{{ ansible_cfg_inventory }}" |
391 | | - force: true |
392 | | - trim_blocks: true |
393 | | - lstrip_blocks: true |
394 | | - when: |
395 | | - - kdevops_workflows_dedicated_workflow |
396 | | - - workflows_reboot_limit |
397 | | - - ansible_hosts_template.stat.exists |
398 | | - |
399 | 159 | - name: Load AI nodes configuration for multi-filesystem setup |
400 | 160 | include_vars: |
401 | 161 | file: "{{ topdir_path }}/{{ kdevops_nodes }}" |
|
415 | 175 | - ai_enable_multifs_testing|default(false)|bool |
416 | 176 | - guestfs_nodes is defined |
417 | 177 |
|
418 | | -- name: Generate the Ansible hosts file for a dedicated AI setup |
419 | | - tags: ['hosts'] |
| 178 | +- name: Generate the Ansible inventory file |
| 179 | + tags: ["hosts"] |
| 180 | + vars: |
| 181 | + # Variables for specific workflows |
| 182 | + gitr_enabled_hosts: "{{ gitr_enabled_test_groups | ansible.builtin.split if kdevops_workflow_enable_gitr else [] }}" |
| 183 | + ltp_enabled_hosts: "{{ ltp_enabled_test_groups | ansible.builtin.split if kdevops_workflow_enable_ltp else [] }}" |
| 184 | + nfstest_enabled_hosts: "{{ nfstest_enabled_test_groups | ansible.builtin.split if kdevops_workflow_enable_nfstest else [] }}" |
| 185 | + # Variables for fstests |
| 186 | + fs_config_data: "{{ lookup('file', fs_config_path) if is_fstests else '' }}" |
| 187 | + sections_without_default: "{{ fs_config_data | regex_replace('\\[default\\]', multiline=True) if is_fstests else '' }}" |
| 188 | + sections_lines: "{{ sections_without_default | regex_findall('^\\[(.*)', multiline=True) if is_fstests else [] }}" |
| 189 | + clean_section_lines: "{{ sections_lines | regex_replace('\\[') | regex_replace('\\]') if is_fstests else [] }}" |
| 190 | + sections_replace_underscore: "{{ clean_section_lines | replace('_', '-') if is_fstests else [] }}" |
| 191 | + sections: "{{ sections_replace_underscore | replace(\"'\", '') | split(', ') if is_fstests else [] }}" |
420 | 192 | ansible.builtin.template: |
421 | 193 | src: "{{ kdevops_hosts_template }}" |
422 | 194 | dest: "{{ ansible_cfg_inventory }}" |
423 | 195 | force: true |
424 | | - trim_blocks: True |
425 | | - lstrip_blocks: True |
426 | | - mode: '0644' |
| 196 | + trim_blocks: true |
| 197 | + lstrip_blocks: true |
427 | 198 | when: |
428 | | - - kdevops_workflows_dedicated_workflow |
429 | | - - kdevops_workflow_enable_ai |
430 | 199 | - ansible_hosts_template.stat.exists |
431 | 200 |
|
| 201 | +- name: Update Ansible inventory access modification time so make sees it updated |
| 202 | + ansible.builtin.file: |
| 203 | + path: "{{ ansible_cfg_inventory }}" |
| 204 | + state: touch |
| 205 | + mode: "0755" |
| 206 | + |
432 | 207 | - name: Verify if final host file exists |
433 | 208 | ansible.builtin.stat: |
434 | 209 | path: "{{ ansible_cfg_inventory }}" |
|
0 commit comments