Debian Codegraph @

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

raw symbols SCIP
1 ---
2 - hosts: foreman
3 become: true
4 tasks:
5 - name: install puppet-prometheus
6 command: /opt/puppetlabs/bin/puppet module install puppet-prometheus
7 args:
8 creates: /etc/puppetlabs/code/environments/production/modules/prometheus/
9 - name: import puppet modules into Foreman
10 command: hammer proxy import-classes --puppet-environment production --name {{ ansible_fqdn }}
11
12 - hosts: localhost
13 collections:
14 - theforeman.foreman
15 gather_facts: false
16 vars_files:
17 - vars/server.yml
18 - vars/host.yml
19 tasks:
20 - include_tasks: tasks/organization.yml
21 vars:
22 organization_name: "{{ host.organization }}"
23 organization_state: present
24 - include_tasks: tasks/location.yml
25 vars:
26 location_name: "{{ host.location }}"
27 location_organizations:
28 - "{{ host.organization }}"
29 location_state: present
30 - include_tasks: tasks/organization.yml
31 vars:
32 organization_name: "{{ host.organization }} Secondary"
33 organization_state: present
34 - include_tasks: tasks/location.yml
35 vars:
36 location_name: "{{ host.location }} Secondary"
37 location_organizations:
38 - "{{ host.organization }} Secondary"
39 location_state: present
40 - include_tasks: tasks/domain.yml
41 vars:
42 domain_name: "{{ host.domain }}"
43 domain_locations:
44 - "{{ host.location }}"
45 domain_organizations:
46 - "{{ host.organization }}"
47 domain_state: present
48 - include_tasks: tasks/subnet.yml
49 vars:
50 subnet_name: "{{ host.subnet }}"
51 subnet_mask: '255.255.255.224'
52 subnet_domains:
53 - "{{ host.domain }}"
54 subnet_locations:
55 - "{{ host.location }}"
56 subnet_organizations:
57 - "{{ host.organization }}"
58 subnet_state: present
59 - include_tasks: tasks/hostgroup.yml
60 vars:
61 hostgroup_name: "{{ host.hostgroup }}"
62 hostgroup_domain: "{{ host.domain }}"
63 hostgroup_locations:
64 - "{{ host.location }}"
65 hostgroup_organizations:
66 - "{{ host.organization }}"
67 hostgroup_state: present
68 - include_tasks: tasks/hostgroup.yml
69 vars:
70 hostgroup_name: "{{ host.hostgroup }}/child_group"
71 hostgroup_domain: "{{ host.domain }}"
72 hostgroup_locations:
73 - "{{ host.location }}"
74 hostgroup_organizations:
75 - "{{ host.organization }}"
76 hostgroup_state: present
77 - include_tasks: tasks/user.yml
78 vars:
79 user_state: present
80 user_password: password
81 - include_tasks: tasks/usergroup.yml
82 vars:
83 usergroup_state: present
84 - include_tasks: tasks/architecture.yml
85 vars:
86 architecture_name: "{{ host.arch }}"
87 architecture_state: present
88 - include_tasks: tasks/operatingsystem.yml
89 vars:
90 operatingsystem_name: "{{ host.os.name }}"
91 operatingsystem_major: "{{ host.os.major }}"
92 operatingsystem_minor: "{{ host.os.minor }}"
93 operatingsystem_family: "{{ host.os.family }}"
94 operatingsystem_architectures:
95 - "{{ host.arch }}"
96 operatingsystem_state: present
97 - include_tasks: tasks/environment.yml
98 vars:
99 environment_state: present
100 environment_name: "production"
101 environment_locations:
102 - "{{ host.location }}"
103 environment_organizations:
104 - "{{ host.organization }}"
105 - include_tasks: tasks/host.yml
106 vars:
107 host_name: "test-host.{{ host.domain }}"
108 host_state: absent
109
110 - hosts: tests
111 collections:
112 - theforeman.foreman
113 gather_facts: false
114 vars_files:
115 - vars/server.yml
116 - vars/host.yml
117 tasks:
118 - name: create host
119 include_tasks: tasks/host.yml
120 vars:
121 host_name: "test-host.{{ host.domain }}"
122 host_organization: "{{ host.organization }}"
123 host_location: "{{ host.location }}"
124 host_managed: false
125 expected_change: true
126
127 - name: create host again, no change
128 include_tasks: tasks/host.yml
129 vars:
130 host_name: "test-host.{{ host.domain }}"
131 host_organization: "{{ host.organization }}"
132 host_location: "{{ host.location }}"
133 host_managed: false
134 expected_change: false
135
136 - name: update host, set owner to a user
137 include_tasks: tasks/host.yml
138 vars:
139 host_name: "test-host.{{ host.domain }}"
140 host_organization: "{{ host.organization }}"
141 host_location: "{{ host.location }}"
142 host_managed: false
143 host_owner: test
144 expected_change: true
145
146 - name: update host, set owner to a user again, no change
147 include_tasks: tasks/host.yml
148 vars:
149 host_name: "test-host.{{ host.domain }}"
150 host_organization: "{{ host.organization }}"
151 host_location: "{{ host.location }}"
152 host_managed: false
153 host_owner: test
154 expected_change: false
155
156 - name: update host, set owner to a usergroup
157 include_tasks: tasks/host.yml
158 vars:
159 host_name: "test-host.{{ host.domain }}"
160 host_organization: "{{ host.organization }}"
161 host_location: "{{ host.location }}"
162 host_managed: false
163 host_owner_group: testgroup
164 expected_change: true
165
166 - name: update host, set owner to a usergroup again, no change
167 include_tasks: tasks/host.yml
168 vars:
169 host_name: "test-host.{{ host.domain }}"
170 host_organization: "{{ host.organization }}"
171 host_location: "{{ host.location }}"
172 host_managed: false
173 host_owner_group: testgroup
174 expected_change: false
175
176 - name: Add subnet to host
177 include_tasks: tasks/host.yml
178 vars:
179 host_name: "test-host.{{ host.domain }}"
180 host_organization: "{{ host.organization }}"
181 host_location: "{{ host.location }}"
182 host_subnet: "{{ host.subnet }}"
183 host_managed: false
184 expected_change: true
185
186 - name: Add subnet to host again, no change
187 include_tasks: tasks/host.yml
188 vars:
189 host_name: "test-host.{{ host.domain }}"
190 host_organization: "{{ host.organization }}"
191 host_location: "{{ host.location }}"
192 host_subnet: "{{ host.subnet }}"
193 host_managed: false
194 expected_change: false
195
196 - name: delete host
197 include_tasks: tasks/host.yml
198 vars:
199 host_name: "test-host.{{ host.domain }}"
200 host_state: absent
201 expected_change: true
202
203 - name: delete host again, no change
204 include_tasks: tasks/host.yml
205 vars:
206 host_name: "test-host.{{ host.domain }}"
207 host_state: absent
208 expected_change: false
209
210 - name: create host with hostgroup
211 include_tasks: tasks/host.yml
212 vars:
213 host_name: "test-host.{{ host.domain }}"
214 host_organization: "{{ host.organization }}"
215 host_location: "{{ host.location }}"
216 host_hostgroup: "{{ host.hostgroup }}"
217 host_managed: false
218 host_build: false
219 expected_change: true
220
221 - name: create host again with hostgroup, no change
222 include_tasks: tasks/host.yml
223 vars:
224 host_name: "test-host.{{ host.domain }}"
225 host_organization: "{{ host.organization }}"
226 host_location: "{{ host.location }}"
227 host_hostgroup: "{{ host.hostgroup }}"
228 host_managed: false
229 host_build: false
230 expected_change: false
231
232 - name: move host to child hostgroup
233 include_tasks: tasks/host.yml
234 vars:
235 host_name: "test-host.{{ host.domain }}"
236 host_organization: "{{ host.organization }}"
237 host_location: "{{ host.location }}"
238 host_hostgroup: "{{ host.hostgroup }}/child_group"
239 host_managed: false
240 host_build: false
241 expected_change: true
242
243 - name: move host again to child hostgroup, no change
244 include_tasks: tasks/host.yml
245 vars:
246 host_name: "test-host.{{ host.domain }}"
247 host_organization: "{{ host.organization }}"
248 host_location: "{{ host.location }}"
249 host_hostgroup: "{{ host.hostgroup }}/child_group"
250 host_managed: false
251 host_build: false
252 expected_change: false
253
254 - name: delete host
255 include_tasks: tasks/host.yml
256 vars:
257 host_name: "test-host.{{ host.domain }}"
258 host_state: absent
259 expected_change: true
260
261 - name: delete host again, no change
262 include_tasks: tasks/host.yml
263 vars:
264 host_name: "test-host.{{ host.domain }}"
265 host_state: absent
266 expected_change: false
267
268 - name: create host with nested hostgroup
269 include_tasks: tasks/host.yml
270 vars:
271 host_name: "test-host.{{ host.domain }}"
272 host_organization: "{{ host.organization }}"
273 host_location: "{{ host.location }}"
274 host_hostgroup: "{{ host.hostgroup }}/child_group"
275 host_managed: false
276 host_build: false
277 expected_change: true
278
279 - name: create host again with nested hostgroup, no change
280 include_tasks: tasks/host.yml
281 vars:
282 host_name: "test-host.{{ host.domain }}"
283 host_organization: "{{ host.organization }}"
284 host_location: "{{ host.location }}"
285 host_hostgroup: "{{ host.hostgroup }}/child_group"
286 host_managed: false
287 host_build: false
288 expected_change: false
289
290 - name: delete host
291 include_tasks: tasks/host.yml
292 vars:
293 host_name: "test-host.{{ host.domain }}"
294 host_state: absent
295 expected_change: true
296
297 - name: delete host again, no change
298 include_tasks: tasks/host.yml
299 vars:
300 host_name: "test-host.{{ host.domain }}"
301 host_state: absent
302 expected_change: false
303
304 - name: create host with ip and mac
305 include_tasks: tasks/host.yml
306 vars:
307 host_name: "test-host.{{ host.domain }}"
308 host_organization: "{{ host.organization }}"
309 host_location: "{{ host.location }}"
310 host_ip: "192.0.2.23"
311 host_mac: "EE:FF:00:00:00:01"
312 host_managed: false
313 host_build: false
314 expected_change: true
315
316 - name: create host again with ip and mac
317 include_tasks: tasks/host.yml
318 vars:
319 host_name: "test-host.{{ host.domain }}"
320 host_organization: "{{ host.organization }}"
321 host_location: "{{ host.location }}"
322 host_ip: "192.0.2.23"
323 host_mac: "EE:FF:00:00:00:01"
324 host_managed: false
325 host_build: false
326 expected_change: false
327
328 - name: delete host
329 include_tasks: tasks/host.yml
330 vars:
331 host_name: "test-host.{{ host.domain }}"
332 host_state: absent
333 expected_change: true
334
335 - name: create host with os and arch
336 include_tasks: tasks/host.yml
337 vars:
338 host_name: "test-host.{{ host.domain }}"
339 host_organization: "{{ host.organization }}"
340 host_location: "{{ host.location }}"
341 host_managed: false
342 host_build: false
343 host_operatingsystem: "{{ host.os.name }}"
344 host_architecture: "{{ host.arch }}"
345 expected_change: true
346
347 - name: create host with os and arch again, no change
348 include_tasks: tasks/host.yml
349 vars:
350 host_name: "test-host.{{ host.domain }}"
351 host_organization: "{{ host.organization }}"
352 host_location: "{{ host.location }}"
353 host_managed: false
354 host_build: false
355 host_operatingsystem: "{{ host.os.name }}"
356 host_architecture: "{{ host.arch }}"
357 expected_change: false
358
359 - name: delete host
360 include_tasks: tasks/host.yml
361 vars:
362 host_name: "test-host.{{ host.domain }}"
363 host_state: absent
364 expected_change: true
365
366 - name: create host with puppetclasses
367 include_tasks: tasks/host.yml
368 vars:
369 host_name: "test-host.{{ host.domain }}"
370 host_organization: "{{ host.organization }}"
371 host_location: "{{ host.location }}"
372 host_managed: false
373 host_build: false
374 host_environment: production
375 host_puppetclasses:
376 - "prometheus::redis_exporter"
377 expected_change: true
378
379 - name: create host with puppetclasses again, no change
380 include_tasks: tasks/host.yml
381 vars:
382 host_name: "test-host.{{ host.domain }}"
383 host_organization: "{{ host.organization }}"
384 host_location: "{{ host.location }}"
385 host_managed: false
386 host_build: false
387 host_environment: production
388 host_puppetclasses:
389 - "prometheus::redis_exporter"
390 expected_change: false
391
392 - name: update host with puppetclasses
393 include_tasks: tasks/host.yml
394 vars:
395 host_name: "test-host.{{ host.domain }}"
396 host_organization: "{{ host.organization }}"
397 host_location: "{{ host.location }}"
398 host_managed: false
399 host_build: false
400 host_environment: production
401 host_puppetclasses:
402 - "prometheus::haproxy_exporter"
403 expected_change: true
404
405 - name: update host with puppetclasses again, no change
406 include_tasks: tasks/host.yml
407 vars:
408 host_name: "test-host.{{ host.domain }}"
409 host_organization: "{{ host.organization }}"
410 host_location: "{{ host.location }}"
411 host_managed: false
412 host_build: false
413 host_environment: production
414 host_puppetclasses:
415 - "prometheus::haproxy_exporter"
416 expected_change: false
417
418 - name: update host with puppetclasses and description
419 include_tasks: tasks/host.yml
420 vars:
421 host_name: "test-host.{{ host.domain }}"
422 host_organization: "{{ host.organization }}"
423 host_location: "{{ host.location }}"
424 host_managed: false
425 host_build: false
426 host_description: nice host
427 host_environment: production
428 host_puppetclasses:
429 - "prometheus::redis_exporter"
430 expected_change: true
431
432 - name: update host with puppetclasses and description again, no change
433 include_tasks: tasks/host.yml
434 vars:
435 host_name: "test-host.{{ host.domain }}"
436 host_organization: "{{ host.organization }}"
437 host_location: "{{ host.location }}"
438 host_managed: false
439 host_build: false
440 host_description: nice host
441 host_environment: production
442 host_puppetclasses:
443 - "prometheus::redis_exporter"
444 expected_change: false
445
446 - name: remove puppetclasses from host
447 include_tasks: tasks/host.yml
448 vars:
449 host_name: "test-host.{{ host.domain }}"
450 host_organization: "{{ host.organization }}"
451 host_location: "{{ host.location }}"
452 host_managed: false
453 host_build: false
454 host_puppetclasses: []
455 expected_change: true
456
457 - name: remove puppetclasses from host again, no change
458 include_tasks: tasks/host.yml
459 vars:
460 host_name: "test-host.{{ host.domain }}"
461 host_organization: "{{ host.organization }}"
462 host_location: "{{ host.location }}"
463 host_managed: false
464 host_build: false
465 host_puppetclasses: []
466 expected_change: false
467
468 - name: delete host
469 include_tasks: tasks/host.yml
470 vars:
471 host_name: "test-host.{{ host.domain }}"
472 host_state: absent
473 expected_change: true
474
475 - name: create host in first org/loc
476 include_tasks: tasks/host.yml
477 vars:
478 host_name: "test-host.{{ host.domain }}"
479 host_organization: "{{ host.organization }}"
480 host_location: "{{ host.location }}"
481 host_managed: false
482 host_build: false
483 expected_change: true
484
485 - name: move host to second org/loc
486 include_tasks: tasks/host.yml
487 vars:
488 host_name: "test-host.{{ host.domain }}"
489 host_organization: "{{ host.organization }} Secondary"
490 host_location: "{{ host.location }} Secondary"
491 host_managed: false
492 host_build: false
493 expected_change: true
494
495 - name: move host to second org/loc again, no change
496 include_tasks: tasks/host.yml
497 vars:
498 host_name: "test-host.{{ host.domain }}"
499 host_organization: "{{ host.organization }} Secondary"
500 host_location: "{{ host.location }} Secondary"
501 host_managed: false
502 host_build: false
503 expected_change: false
504
505 - name: delete host
506 include_tasks: tasks/host.yml
507 vars:
508 host_name: "test-host.{{ host.domain }}"
509 host_state: absent
510 expected_change: true
511
512 - hosts: localhost
513 collections:
514 - theforeman.foreman
515 gather_facts: false
516 vars_files:
517 - vars/server.yml
518 - vars/host.yml
519 tasks:
520 - include_tasks: tasks/user.yml
521 vars:
522 user_state: absent
523 - include_tasks: tasks/usergroup.yml
524 vars:
525 usergroup_state: absent
526 - include_tasks: tasks/hostgroup.yml
527 vars:
528 hostgroup_name: "{{ host.hostgroup }}/child_group"
529 hostgroup_state: absent
530 - include_tasks: tasks/hostgroup.yml
531 vars:
532 hostgroup_name: "{{ host.hostgroup }}"
533 hostgroup_state: absent
534 - include_tasks: tasks/subnet.yml
535 vars:
536 subnet_name: "{{ host.subnet }}"
537 subnet_mask: '255.255.255.224'
538 subnet_domains: []
539 subnet_state: present
540 - include_tasks: tasks/subnet.yml
541 vars:
542 subnet_name: "{{ host.subnet }}"
543 subnet_mask: '255.255.255.224'
544 subnet_state: absent
545 - include_tasks: tasks/domain.yml
546 vars:
547 domain_name: "{{ host.domain }}"
548 domain_state: absent
549 - include_tasks: tasks/operatingsystem.yml
550 vars:
551 operatingsystem_name: "{{ host.os.name }}"
552 operatingsystem_state: absent
553 - include_tasks: tasks/architecture.yml
554 vars:
555 architecture_name: "{{ host.arch }}"
556 architecture_state: absent
557 - include_tasks: tasks/location.yml
558 vars:
559 location_name: "{{ host.location }} Secondary"
560 location_state: absent
561 - include_tasks: tasks/organization.yml
562 vars:
563 organization_name: "{{ host.organization }} Secondary"
564 organization_state: absent
565 - include_tasks: tasks/location.yml
566 vars:
567 location_name: "{{ host.location }}"
568 location_state: absent
569 - include_tasks: tasks/organization.yml
570 vars:
571 organization_name: "{{ host.organization }}"
572 organization_state: absent
573 ...