Debian Codegraph @

ansible_collections/theforeman/foreman/tests/test_playbooks/hostgroup.yml

raw symbols SCIP
1 ---
2 ## To record cassettes using this playbook (record_hostgroup)
3 ## some puppet classes need to be imported.
4 ## See comments in #582 for details. To import the classes run:
5 ##
6 ## $ puppet module install puppet-prometheus
7 ## $ hammer proxy import-classes --puppet-environment production --name $(hostname -f)
8 ##
9 ## You also need the libvirt compute resource support enabled:
10 ## $ foreman-installer --enable-foreman-compute-libvirt
11 ## And libvirt up and running:
12 ## $ dnf install libvirt
13 ## $ systemctl enable --now libvirtd
14 ## $ usermod -aG libvirt foreman
15 ##
16 ## You also need the proxy to be setup with the DNS feature:
17 ## $ foreman-installer --foreman-proxy-dns true
18 ##
19
20 - hosts: localhost
21 collections:
22 - theforeman.foreman
23 gather_facts: false
24 vars_files:
25 - vars/server.yml
26 - vars/hostgroup.yml
27 - vars/compute_profile.yml
28 tasks:
29 - include_tasks: tasks/location.yml
30 vars:
31 location_name: "{{ item }}"
32 location_state: present
33 with_items: "{{ hostgroup.locations }}"
34 - include_tasks: tasks/organization.yml
35 vars:
36 organization_name: "{{ item }}"
37 organization_state: present
38 with_items: "{{ hostgroup.organizations }}"
39 - include_tasks: tasks/domain.yml
40 vars:
41 domain_organizations: "{{ hostgroup.organizations }}"
42 domain_locations: "{{ hostgroup.locations }}"
43 domain_name: "{{ item }}"
44 domain_dns_proxy: "{{ hostgroup.dns_proxy }}"
45 domain_state: present
46 with_items: "{{ hostgroup.domains }}"
47 - include_tasks: tasks/subnet.yml
48 vars:
49 subnet_name: "{{ hostgroup.subnet }}"
50 subnet_mask: '255.255.255.224'
51 subnet_domains: "{{ hostgroup.domains }}"
52 subnet_state: present
53 - include_tasks: tasks/ptable.yml
54 vars:
55 ptable_name: "{{ hostgroup.ptable }}"
56 ptable_os_family: "{{ hostgroup.os.family }}"
57 ptable_locations: "{{ hostgroup.locations }}"
58 ptable_organizations: "{{ hostgroup.organizations }}"
59 ptable_state: present
60 - include_tasks: tasks/operatingsystem.yml
61 vars:
62 operatingsystem_name: "{{ hostgroup.os.name }}"
63 operatingsystem_major: "{{ hostgroup.os.major }}"
64 operatingsystem_minor: "{{ hostgroup.os.minor }}"
65 operatingsystem_family: "{{ hostgroup.os.family }}"
66 operatingsystem_architectures:
67 - "{{ hostgroup.arch }}"
68 operatingsystem_ptables:
69 - "{{ hostgroup.ptable }}"
70 operatingsystem_state: present
71 - include_tasks: tasks/installation_medium.yml
72 vars:
73 installation_medium_name: "{{ hostgroup.os.name }} Mirror"
74 installation_medium_operatingsystems:
75 - "{{ hostgroup.os.name }} {{ hostgroup.os.major }}.{{ hostgroup.os.minor }}"
76 installation_medium_locations: "{{ hostgroup.locations }}"
77 installation_medium_organizations: "{{ hostgroup.organizations }}"
78 installation_medium_path: "https://mirror.example.com/{{ hostgroup.os.name }}/"
79 installation_medium_state: present
80 - include_tasks: tasks/compute_resource.yml
81 vars:
82 compute_resource_name: "{{ hostgroup.compute_resource.name }}"
83 compute_resource_organizations: "{{ hostgroup.organizations }}"
84 compute_resource_locations: "{{ hostgroup.locations }}"
85 compute_resource_provider: 'libvirt'
86 compute_resource_provider_params: "{{ libvirt.compute_resource.params }}"
87 compute_resource_state: present
88 - include_tasks: tasks/compute_profile.yml
89 vars:
90 compute_profile_name: "{{ hostgroup.compute_profile.name }}"
91 compute_profile_attributes:
92 - compute_resource: "{{ hostgroup.compute_resource.name }}"
93 vm_attrs: "{{ libvirt.compute_profile.attrs }}"
94 compute_profile_state: present
95 - include_tasks: tasks/config_group.yml
96 vars:
97 config_group_name: "{{ item }}"
98 config_group_state: present
99 with_items: "{{ hostgroup.config_groups }}"
100 - include_tasks: tasks/hostgroup.yml
101 vars:
102 hostgroup_state: absent
103 - include_tasks: tasks/hostgroup.yml
104 vars:
105 hostgroup_state: absent
106 hostgroup_name: "{{ item }}"
107 loop:
108 - "Nested New host group"
109 - "New host group/Nested New host group 1"
110 - "New host group/Nested New host group 10"
111 - "New host group/Nested New host group 2"
112 - "New host group/Nested New host group/New host group with nested parent"
113 - "New host group/Whatever Child"
114 - "New host group"
115 - "New host group with nested parent"
116 - "New host group with puppet classes"
117 - "Super New host group"
118 - "Super New host group 2"
119
120 - hosts: tests
121 collections:
122 - theforeman.foreman
123 gather_facts: false
124 vars_files:
125 - vars/server.yml
126 - vars/hostgroup.yml
127 tasks:
128 - include_tasks: tasks/hostgroup.yml
129 vars:
130 hostgroup_name: "New host group"
131 hostgroup_description: "New host group"
132 hostgroup_architecture: "{{ hostgroup.arch }}"
133 hostgroup_operatingsystem: "{{ hostgroup.os.name }} {{ hostgroup.os.major }}.{{ hostgroup.os.minor }}"
134 hostgroup_locations: "{{ hostgroup.locations }}"
135 hostgroup_organizations: "{{ hostgroup.organizations }}"
136 hostgroup_compute_resource: "{{ hostgroup.compute_resource.name }}"
137 hostgroup_compute_profile: "{{ hostgroup.compute_profile.name }}"
138 hostgroup_domain: "{{ hostgroup.domains | first }}"
139 hostgroup_subnet: "{{ hostgroup.subnet }}"
140 hostgroup_installation_medium: "{{ hostgroup.os.name }} Mirror"
141 hostgroup_ptable: "{{ hostgroup.ptable }}"
142 hostgroup_pxe_loader: "Grub2 UEFI"
143 hostgroup_environment: "production"
144 hostgroup_puppet_proxy: "{{ hostgroup.puppet_server }}"
145 hostgroup_puppet_ca_proxy: "{{ hostgroup.puppet_ca }}"
146 hostgroup_config_groups: "{{ hostgroup.config_groups }}"
147 hostgroup_parameters:
148 - name: subnet_param1
149 value: value1
150 - name: subnet_param2
151 value: value2
152 - name: hidden_secret
153 value: super_secret
154 hidden_value: true
155 - name: excplicit_text
156 value: not_secret
157 hidden_value: false
158 hostgroup_state: present
159 expected_change: true
160
161 - include_tasks: tasks/hostgroup.yml
162 vars:
163 hostgroup_name: "New host group with puppet classes"
164 hostgroup_description: "New host group"
165 hostgroup_architecture: "{{ hostgroup.arch }}"
166 hostgroup_operatingsystem: "{{ hostgroup.os.name }} {{ hostgroup.os.major }}.{{ hostgroup.os.minor }}"
167 hostgroup_locations: "{{ hostgroup.locations }}"
168 hostgroup_organizations: "{{ hostgroup.organizations }}"
169 hostgroup_compute_resource: "{{ hostgroup.compute_resource.name }}"
170 hostgroup_compute_profile: "{{ hostgroup.compute_profile.name }}"
171 hostgroup_domain: "{{ hostgroup.domains | first }}"
172 hostgroup_subnet: "{{ hostgroup.subnet }}"
173 hostgroup_installation_medium: "{{ hostgroup.os.name }} Mirror"
174 hostgroup_ptable: "{{ hostgroup.ptable }}"
175 hostgroup_pxe_loader: "Grub2 UEFI"
176 hostgroup_environment: "production"
177 hostgroup_puppet_proxy: "{{ hostgroup.puppet_server }}"
178 hostgroup_puppet_ca_proxy: "{{ hostgroup.puppet_ca }}"
179 hostgroup_config_groups: "{{ hostgroup.config_groups }}"
180 hostgroup_puppetclasses:
181 - "prometheus::redis_exporter"
182 hostgroup_parameters:
183 - name: subnet_param1
184 value: value1
185 - name: subnet_param2
186 value: value2
187 - name: hidden_secret
188 value: super_secret
189 hidden_value: true
190 - name: excplicit_text
191 value: not_secret
192 hidden_value: false
193 hostgroup_state: present
194 expected_change: true
195
196 - include_tasks: tasks/hostgroup.yml
197 vars:
198 hostgroup_name: "New host group with puppet classes"
199 hostgroup_description: "New host group"
200 hostgroup_architecture: "{{ hostgroup.arch }}"
201 hostgroup_operatingsystem: "{{ hostgroup.os.name }} {{ hostgroup.os.major }}.{{ hostgroup.os.minor }}"
202 hostgroup_locations: "{{ hostgroup.locations }}"
203 hostgroup_organizations: "{{ hostgroup.organizations }}"
204 hostgroup_compute_profile: "{{ hostgroup.compute_profile.name }}"
205 hostgroup_domain: "{{ hostgroup.domains | first }}"
206 hostgroup_subnet: "{{ hostgroup.subnet }}"
207 hostgroup_installation_medium: "{{ hostgroup.os.name }} Mirror"
208 hostgroup_ptable: "{{ hostgroup.ptable }}"
209 hostgroup_pxe_loader: "Grub2 UEFI"
210 hostgroup_environment: "production"
211 hostgroup_puppet_proxy: "{{ hostgroup.puppet_server }}"
212 hostgroup_puppet_ca_proxy: "{{ hostgroup.puppet_ca }}"
213 hostgroup_config_groups: "{{ hostgroup.config_groups }}"
214 hostgroup_puppetclasses:
215 - "prometheus::redis_exporter"
216 hostgroup_parameters:
217 - name: subnet_param1
218 value: value1
219 - name: subnet_param2
220 value: value2
221 - name: hidden_secret
222 value: super_secret
223 hidden_value: true
224 - name: excplicit_text
225 value: not_secret
226 hidden_value: false
227 hostgroup_state: present
228 expected_change: false
229
230 - include_tasks: tasks/hostgroup.yml
231 vars:
232 hostgroup_name: "New host group with puppet classes"
233 hostgroup_description: "New host group"
234 hostgroup_architecture: "{{ hostgroup.arch }}"
235 hostgroup_operatingsystem: "{{ hostgroup.os.name }} {{ hostgroup.os.major }}.{{ hostgroup.os.minor }}"
236 hostgroup_locations: "{{ hostgroup.locations }}"
237 hostgroup_organizations: "{{ hostgroup.organizations }}"
238 hostgroup_compute_profile: "{{ hostgroup.compute_profile.name }}"
239 hostgroup_domain: "{{ hostgroup.domains | first }}"
240 hostgroup_subnet: "{{ hostgroup.subnet }}"
241 hostgroup_installation_medium: "{{ hostgroup.os.name }} Mirror"
242 hostgroup_ptable: "{{ hostgroup.ptable }}"
243 hostgroup_pxe_loader: "Grub2 UEFI"
244 hostgroup_environment: "production"
245 hostgroup_puppet_proxy: "{{ hostgroup.puppet_server }}"
246 hostgroup_puppet_ca_proxy: "{{ hostgroup.puppet_ca }}"
247 hostgroup_config_groups: "{{ hostgroup.config_groups }}"
248 hostgroup_puppetclasses:
249 - "prometheus::redis_exporter"
250 - "prometheus::statsd_exporter"
251 hostgroup_parameters:
252 - name: subnet_param1
253 value: value1
254 - name: subnet_param2
255 value: value2
256 - name: hidden_secret
257 value: super_secret
258 hidden_value: true
259 - name: excplicit_text
260 value: not_secret
261 hidden_value: false
262 hostgroup_state: present
263 expected_change: true
264
265 - include_tasks: tasks/hostgroup.yml
266 vars:
267 hostgroup_name: "New host group with puppet classes"
268 hostgroup_description: "New host group"
269 hostgroup_architecture: "{{ hostgroup.arch }}"
270 hostgroup_operatingsystem: "{{ hostgroup.os.name }} {{ hostgroup.os.major }}.{{ hostgroup.os.minor }}"
271 hostgroup_locations: "{{ hostgroup.locations }}"
272 hostgroup_organizations: "{{ hostgroup.organizations }}"
273 hostgroup_compute_profile: "{{ hostgroup.compute_profile.name }}"
274 hostgroup_domain: "{{ hostgroup.domains | first }}"
275 hostgroup_subnet: "{{ hostgroup.subnet }}"
276 hostgroup_installation_medium: "{{ hostgroup.os.name }} Mirror"
277 hostgroup_ptable: "{{ hostgroup.ptable }}"
278 hostgroup_pxe_loader: "Grub2 UEFI"
279 hostgroup_environment: "production"
280 hostgroup_puppet_proxy: "{{ hostgroup.puppet_server }}"
281 hostgroup_puppet_ca_proxy: "{{ hostgroup.puppet_ca }}"
282 hostgroup_config_groups: "{{ hostgroup.config_groups }}"
283 hostgroup_puppetclasses:
284 - "prometheus::statsd_exporter"
285 hostgroup_parameters:
286 - name: subnet_param1
287 value: value1
288 - name: subnet_param2
289 value: value2
290 - name: hidden_secret
291 value: super_secret
292 hidden_value: true
293 - name: excplicit_text
294 value: not_secret
295 hidden_value: false
296 hostgroup_state: present
297 expected_change: true
298
299 - include_tasks: tasks/hostgroup.yml
300 vars:
301 hostgroup_name: "New host group with puppet classes"
302 hostgroup_description: "New host group"
303 hostgroup_architecture: "{{ hostgroup.arch }}"
304 hostgroup_operatingsystem: "{{ hostgroup.os.name }} {{ hostgroup.os.major }}.{{ hostgroup.os.minor }}"
305 hostgroup_locations: "{{ hostgroup.locations }}"
306 hostgroup_organizations: "{{ hostgroup.organizations }}"
307 hostgroup_compute_profile: "{{ hostgroup.compute_profile.name }}"
308 hostgroup_domain: "{{ hostgroup.domains | first }}"
309 hostgroup_subnet: "{{ hostgroup.subnet }}"
310 hostgroup_installation_medium: "{{ hostgroup.os.name }} Mirror"
311 hostgroup_ptable: "{{ hostgroup.ptable }}"
312 hostgroup_pxe_loader: "Grub2 UEFI"
313 hostgroup_environment: "production"
314 hostgroup_puppet_proxy: "{{ hostgroup.puppet_server }}"
315 hostgroup_puppet_ca_proxy: "{{ hostgroup.puppet_ca }}"
316 hostgroup_config_groups: "{{ hostgroup.config_groups }}"
317 hostgroup_puppetclasses:
318 - "prometheus::statsd_exporter"
319 hostgroup_parameters:
320 - name: subnet_param1
321 value: value1
322 - name: subnet_param2
323 value: value2
324 - name: hidden_secret
325 value: super_secret
326 hidden_value: true
327 - name: excplicit_text
328 value: not_secret
329 hidden_value: false
330 hostgroup_state: present
331 expected_change: false
332
333 - include_tasks: tasks/hostgroup.yml
334 vars:
335 hostgroup_name: "New host group with puppet classes"
336 hostgroup_description: "New host group"
337 hostgroup_architecture: "{{ hostgroup.arch }}"
338 hostgroup_operatingsystem: "{{ hostgroup.os.name }} {{ hostgroup.os.major }}.{{ hostgroup.os.minor }}"
339 hostgroup_locations: "{{ hostgroup.locations }}"
340 hostgroup_organizations: "{{ hostgroup.organizations }}"
341 hostgroup_compute_profile: "{{ hostgroup.compute_profile.name }}"
342 hostgroup_domain: "{{ hostgroup.domains | first }}"
343 hostgroup_subnet: "{{ hostgroup.subnet }}"
344 hostgroup_installation_medium: "{{ hostgroup.os.name }} Mirror"
345 hostgroup_ptable: "{{ hostgroup.ptable }}"
346 hostgroup_pxe_loader: "Grub2 UEFI"
347 hostgroup_environment: "production"
348 hostgroup_puppet_proxy: "{{ hostgroup.puppet_server }}"
349 hostgroup_puppet_ca_proxy: "{{ hostgroup.puppet_ca }}"
350 hostgroup_config_groups: "{{ hostgroup.config_groups }}"
351 hostgroup_puppetclasses:
352 - "prometheus::statsd_exporter"
353 hostgroup_parameters:
354 - name: subnet_param1
355 value: value1
356 - name: subnet_param2
357 value: value2
358 - name: hidden_secret
359 value: super_secret
360 hidden_value: true
361 - name: excplicit_text
362 value: not_secret
363 hidden_value: false
364 hostgroup_state: absent
365 expected_change: true
366
367 - include_tasks: tasks/hostgroup.yml
368 vars:
369 hostgroup_name: "New host group"
370 hostgroup_description: "New host group"
371 hostgroup_architecture: "{{ hostgroup.arch }}"
372 hostgroup_operatingsystem: "{{ hostgroup.os.name }} {{ hostgroup.os.major }}.{{ hostgroup.os.minor }}"
373 hostgroup_locations: "{{ hostgroup.locations }}"
374 hostgroup_organizations: "{{ hostgroup.organizations }}"
375 # The foreman api does not report the compute_resource_id/name; we cannot test this
376 # See also https://projects.theforeman.org/issues/27460
377 # hostgroup_compute_resource: "{{ hostgroup.compute_resource.name }}"
378 hostgroup_compute_profile: "{{ hostgroup.compute_profile.name }}"
379 hostgroup_domain: "{{ hostgroup.domains | first }}"
380 hostgroup_subnet: "{{ hostgroup.subnet }}"
381 hostgroup_installation_medium: "{{ hostgroup.os.name }} Mirror"
382 hostgroup_ptable: "{{ hostgroup.ptable }}"
383 hostgroup_pxe_loader: "Grub2 UEFI"
384 hostgroup_environment: "production"
385 hostgroup_puppet_proxy: "{{ hostgroup.puppet_server }}"
386 hostgroup_puppet_ca_proxy: "{{ hostgroup.puppet_ca }}"
387 hostgroup_config_groups: "{{ hostgroup.config_groups }}"
388 hostgroup_state: present
389 expected_change: false
390
391 - include_tasks: tasks/hostgroup.yml
392 vars:
393 hostgroup_name: "Nested New host group"
394 hostgroup_description: "Nested group"
395 hostgroup_parent: "New host group"
396 hostgroup_architecture: "{{ hostgroup.arch }}"
397 hostgroup_operatingsystem: "{{ hostgroup.os.name }} {{ hostgroup.os.major }}.{{ hostgroup.os.minor }}"
398 hostgroup_locations: "{{ hostgroup.locations }}"
399 hostgroup_organizations: "{{ hostgroup.organizations }}"
400 hostgroup_domain: "{{ hostgroup.domains | first }}"
401 hostgroup_subnet: "{{ hostgroup.subnet }}"
402 hostgroup_installation_medium: "{{ hostgroup.os.name }} Mirror"
403 hostgroup_ptable: "{{ hostgroup.ptable }}"
404 hostgroup_pxe_loader: "Grub2 UEFI"
405 hostgroup_puppet_proxy: "{{ hostgroup.puppet_server }}"
406 hostgroup_puppet_ca_proxy: "{{ hostgroup.puppet_ca }}"
407 hostgroup_state: present
408 expected_change: true
409
410 - include_tasks: tasks/hostgroup.yml
411 vars:
412 hostgroup_name: "Nested New host group"
413 hostgroup_description: "Nested group"
414 hostgroup_parent: "New host group"
415 hostgroup_architecture: "{{ hostgroup.arch }}"
416 hostgroup_operatingsystem: "{{ hostgroup.os.name }} {{ hostgroup.os.major }}.{{ hostgroup.os.minor }}"
417 hostgroup_locations: "{{ hostgroup.locations }}"
418 hostgroup_organizations: "{{ hostgroup.organizations }}"
419 hostgroup_domain: "{{ hostgroup.domains | first }}"
420 hostgroup_subnet: "{{ hostgroup.subnet }}"
421 hostgroup_installation_medium: "{{ hostgroup.os.name }} Mirror"
422 hostgroup_ptable: "{{ hostgroup.ptable }}"
423 hostgroup_pxe_loader: "Grub2 UEFI"
424 hostgroup_puppet_proxy: "{{ hostgroup.puppet_server }}"
425 hostgroup_puppet_ca_proxy: "{{ hostgroup.puppet_ca }}"
426 hostgroup_state: present
427 expected_change: false
428
429 - include_tasks: tasks/hostgroup.yml
430 vars:
431 hostgroup_name: "New host group with nested parent"
432 hostgroup_description: "Nested group"
433 hostgroup_parent: "New host group/Nested New host group"
434 hostgroup_architecture: "{{ hostgroup.arch }}"
435 hostgroup_operatingsystem: "{{ hostgroup.os.name }} {{ hostgroup.os.major }}.{{ hostgroup.os.minor }}"
436 hostgroup_locations: "{{ hostgroup.locations }}"
437 hostgroup_organizations: "{{ hostgroup.organizations }}"
438 hostgroup_domain: "{{ hostgroup.domains | first }}"
439 hostgroup_subnet: "{{ hostgroup.subnet }}"
440 hostgroup_installation_medium: "{{ hostgroup.os.name }} Mirror"
441 hostgroup_ptable: "{{ hostgroup.ptable }}"
442 hostgroup_pxe_loader: "Grub2 UEFI"
443 hostgroup_puppet_proxy: "{{ hostgroup.puppet_server }}"
444 hostgroup_puppet_ca_proxy: "{{ hostgroup.puppet_ca }}"
445 hostgroup_state: present
446 expected_change: true
447
448 - include_tasks: tasks/hostgroup.yml
449 vars:
450 hostgroup_name: "New host group with nested parent"
451 hostgroup_description: "Nested group"
452 hostgroup_parent: "New host group/Nested New host group"
453 hostgroup_architecture: "{{ hostgroup.arch }}"
454 hostgroup_operatingsystem: "{{ hostgroup.os.name }} {{ hostgroup.os.major }}.{{ hostgroup.os.minor }}"
455 hostgroup_locations: "{{ hostgroup.locations }}"
456 hostgroup_organizations: "{{ hostgroup.organizations }}"
457 hostgroup_domain: "{{ hostgroup.domains | first }}"
458 hostgroup_subnet: "{{ hostgroup.subnet }}"
459 hostgroup_installation_medium: "{{ hostgroup.os.name }} Mirror"
460 hostgroup_ptable: "{{ hostgroup.ptable }}"
461 hostgroup_pxe_loader: "Grub2 UEFI"
462 hostgroup_puppet_proxy: "{{ hostgroup.puppet_server }}"
463 hostgroup_puppet_ca_proxy: "{{ hostgroup.puppet_ca }}"
464 hostgroup_state: present
465 expected_change: false
466
467 - include_tasks: tasks/hostgroup.yml
468 vars:
469 hostgroup_name: "New host group/Nested New host group 2"
470 hostgroup_architecture: "{{ hostgroup.arch }}"
471 hostgroup_operatingsystem: "{{ hostgroup.os.name }} {{ hostgroup.os.major }}.{{ hostgroup.os.minor }}"
472 hostgroup_locations: "{{ hostgroup.locations }}"
473 hostgroup_organizations: "{{ hostgroup.organizations }}"
474 hostgroup_installation_medium: "{{ hostgroup.os.name }} Mirror"
475 hostgroup_ptable: "{{ hostgroup.ptable }}"
476 hostgroup_pxe_loader: "PXELinux BIOS"
477 hostgroup_state: present
478 expected_change: true
479
480 - include_tasks: tasks/hostgroup.yml
481 vars:
482 hostgroup_name: "New host group/Nested New host group 2"
483 hostgroup_architecture: "{{ hostgroup.arch }}"
484 hostgroup_operatingsystem: "{{ hostgroup.os.name }} {{ hostgroup.os.major }}.{{ hostgroup.os.minor }}"
485 hostgroup_locations: "{{ hostgroup.locations }}"
486 hostgroup_organizations: "{{ hostgroup.organizations }}"
487 hostgroup_installation_medium: "{{ hostgroup.os.name }} Mirror"
488 hostgroup_ptable: "{{ hostgroup.ptable }}"
489 hostgroup_pxe_loader: "PXELinux BIOS"
490 hostgroup_state: present
491 expected_change: false
492
493 - include_tasks: tasks/hostgroup.yml
494 vars:
495 hostgroup_name: "New host group"
496 hostgroup_parameters:
497 - name: subnet_param1
498 value: new_value1
499 - name: subnet_param3
500 value: value3
501 hostgroup_state: present
502 expected_change: true
503
504 - include_tasks: tasks/hostgroup.yml
505 vars:
506 hostgroup_name: "New host group"
507 hostgroup_parameters:
508 - name: subnet_param1
509 value: new_value1
510 - name: subnet_param3
511 value: value3
512 hostgroup_state: present
513 expected_change: false
514
515 - include_tasks: tasks/hostgroup.yml
516 vars:
517 hostgroup_name: "Super New host group"
518 hostgroup_state: present
519 expected_change: true
520
521 - include_tasks: tasks/hostgroup.yml
522 vars:
523 hostgroup_name: "Super New host group"
524 hostgroup_updated_name: "Super New host group 2"
525 hostgroup_state: present
526 expected_change: true
527
528 - include_tasks: tasks/hostgroup.yml
529 vars:
530 hostgroup_name: "Super New host group 2"
531 hostgroup_state: absent
532 expected_change: true
533
534 - include_tasks: tasks/hostgroup.yml
535 vars:
536 hostgroup_name: "New host group/Nested New host group 1"
537 hostgroup_state: present
538 expected_change: true
539
540 - include_tasks: tasks/hostgroup.yml
541 vars:
542 hostgroup_name: "New host group/Nested New host group 1"
543 hostgroup_updated_name: "Nested New host group 10"
544 hostgroup_state: present
545 expected_change: true
546
547 - include_tasks: tasks/hostgroup.yml
548 vars:
549 hostgroup_name: "New host group/Nested New host group 10"
550 hostgroup_state: present
551 expected_change: false
552
553 - include_tasks: tasks/hostgroup.yml
554 vars:
555 hostgroup_name: "New host group/Nested New host group 10"
556 hostgroup_state: absent
557 expected_change: true
558
559 - include_tasks: tasks/hostgroup.yml
560 vars:
561 hostgroup_name: "New host group/Nested New host group 2"
562 hostgroup_state: absent
563 expected_change: true
564
565 - include_tasks: tasks/hostgroup.yml
566 vars:
567 hostgroup_name: "New host group/Nested New host group 2"
568 hostgroup_state: absent
569 expected_change: false
570
571 - include_tasks: tasks/hostgroup.yml
572 vars:
573 hostgroup_name: "New host group/Nested New host group/New host group with nested parent"
574 hostgroup_state: absent
575 expected_change: true
576
577 - include_tasks: tasks/hostgroup.yml
578 vars:
579 hostgroup_name: "New host group/Nested New host group/New host group with nested parent"
580 hostgroup_state: absent
581 expected_change: false
582
583 - include_tasks: tasks/hostgroup.yml
584 vars:
585 hostgroup_name: "Nested New host group"
586 hostgroup_parent: "New host group"
587 hostgroup_state: absent
588 expected_change: true
589
590 - include_tasks: tasks/hostgroup.yml
591 vars:
592 hostgroup_name: "Nested New host group"
593 hostgroup_parent: "New host group"
594 hostgroup_state: absent
595 expected_change: false
596
597 - include_tasks: tasks/hostgroup.yml
598 vars:
599 hostgroup_name: "New host group"
600 hostgroup_root_pass: "changeme"
601 hostgroup_state: present
602 expected_change: true
603
604 - include_tasks: tasks/hostgroup.yml
605 vars:
606 hostgroup_name: "New host group"
607 hostgroup_root_pass: "changeme"
608 hostgroup_state: present
609 expected_change: true
610
611 - include_tasks: tasks/hostgroup.yml
612 vars:
613 hostgroup_name: "New host group"
614 hostgroup_state: absent
615 expected_change: true
616
617 - include_tasks: tasks/hostgroup.yml
618 vars:
619 hostgroup_name: "New host group"
620 hostgroup_state: absent
621 expected_change: false
622
623 - include_tasks: tasks/hostgroup.yml
624 vars:
625 hostgroup_name: "New host group/Whatever Child"
626 hostgroup_state: absent
627 expected_change: false
628
629 - hosts: localhost
630 collections:
631 - theforeman.foreman
632 gather_facts: false
633 vars_files:
634 - vars/server.yml
635 - vars/hostgroup.yml
636 tasks:
637 - include_tasks: tasks/hostgroup.yml
638 vars:
639 hostgroup_state: absent
640 hostgroup_name: "{{ item }}"
641 loop:
642 - "Nested New host group"
643 - "New host group/Nested New host group 1"
644 - "New host group/Nested New host group 10"
645 - "New host group/Nested New host group 2"
646 - "New host group/Nested New host group/New host group with nested parent"
647 - "New host group/Whatever Child"
648 - "New host group"
649 - "New host group with nested parent"
650 - "New host group with puppet classes"
651 - "Super New host group"
652 - "Super New host group 2"
653 - include_tasks: tasks/config_group.yml
654 vars:
655 config_group_name: "{{ item }}"
656 config_group_state: absent
657 with_items: "{{ hostgroup.config_groups }}"
658 # There is chicken and egg problem with subnet-domains relation, so we have to
659 # dissociate subnets and domains before delete
660 - include_tasks: tasks/subnet.yml
661 vars:
662 subnet_name: "{{ hostgroup.subnet }}"
663 subnet_domains: []
664 subnet_mask: '255.255.255.224'
665 subnet_state: present
666 - include_tasks: tasks/domain.yml
667 vars:
668 domain_organizations: "{{ hostgroup.organizations }}"
669 domain_locations: "{{ hostgroup.locations }}"
670 domain_name: "{{ item }}"
671 domain_state: absent
672 with_items: "{{ hostgroup.domains }}"
673 - include_tasks: tasks/subnet.yml
674 vars:
675 subnet_name: "{{ hostgroup.subnet }}"
676 subnet_mask: '255.255.255.224'
677 subnet_state: absent
678 - include_tasks: tasks/compute_profile.yml
679 vars:
680 compute_profile_name: "{{ hostgroup.compute_profile.name }}"
681 compute_profile_state: absent
682 - include_tasks: tasks/compute_resource.yml
683 vars:
684 compute_profile_name: "{{ hostgroup.compute_profile.name }}"
685 compute_resource_provider: 'libvirt'
686 compute_resource_state: absent
687 - include_tasks: tasks/operatingsystem.yml
688 vars:
689 operatingsystem_name: "{{ hostgroup.os.name }}"
690 operatingsystem_major: "{{ hostgroup.os.major }}"
691 operatingsystem_minor: "{{ hostgroup.os.minor }}"
692 operatingsystem_state: absent
693 - include_tasks: tasks/ptable.yml
694 vars:
695 ptable_name: "{{ hostgroup.ptable }}"
696 ptable_state: absent
697 - include_tasks: tasks/installation_medium.yml
698 vars:
699 installation_medium_name: "{{ hostgroup.os.name }} Mirror"
700 installation_medium_state: absent
701 - include_tasks: tasks/location.yml
702 vars:
703 location_name: "{{ item }}"
704 location_state: "absent"
705 with_items: "{{ hostgroup.locations | reverse | list }}"
706 - include_tasks: tasks/organization.yml
707 vars:
708 organization_name: "{{ item }}"
709 organization_state: "absent"
710 with_items: "{{ hostgroup.organizations }}"
711 ...