-
Notifications
You must be signed in to change notification settings - Fork 12
/
bootstrap.yaml
executable file
·1105 lines (1006 loc) · 38.1 KB
/
bootstrap.yaml
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
- name: Create an Assisted Installer provisioned OpenShift Cluster on mixed infrastructure
hosts: localhost
gather_facts: false
module_defaults:
kubernetes.core.k8s:
validate_certs: false
kubernetes.core.k8s_info:
validate_certs: false
vars:
cluster_id: ""
infraenv_id: ""
cluster_status: ""
deployment_name: ""
compiled_uri_headers:
User-Agent: AnsibleAutomation/4.2
generated_asset_directory: "./.generated"
detected_infra_nodes: false
install_config_overrides: {}
use_site_configs: false
# Bare Metal Vars
deploy_local_http_server: false
http_server_port: 7654
# ipmi_iso_url: http://raza.kemo.labs:{{ http_server_port }}/ocp_ai.iso
tasks:
- name: Read in variables
when: not use_site_configs | bool
ansible.builtin.include_vars:
dir: vars
extensions:
- 'yaml'
- 'yml'
tags:
- always
- name: SITECONFIG - Read in default variables
when: use_site_configs | bool
ansible.builtin.include_vars:
dir: defaults
extensions:
- 'yaml'
- 'yml'
tags:
- always
- name: SITECONFIG - Read in site configs
when:
- use_site_configs | bool
- site_config_name is defined
ansible.builtin.include_vars:
dir: "site-config/{{ site_config_name }}"
extensions:
- 'yaml'
- 'yml'
tags:
- always
# =========================================================================================================================
# Preflight
# =========================================================================================================================
- name: Initial Preflight Checks
ansible.builtin.include_tasks:
file: tasks/preflight/main.yaml
apply:
tags:
- preflight
- always
tags:
- preflight
- always
- name: Create generation directories
ansible.builtin.file:
state: directory
path: "{{ path_item }}"
mode: '0755'
loop:
- "{{ generated_asset_directory }}"
- "{{ generated_asset_directory }}/bin/"
loop_control:
loop_var: path_item
tags:
- preflight
- create_directories
- name: Preflight Check - Check for OpenShift binaries
ansible.builtin.include_tasks:
file: tasks/preflight/check_ocp_binaries.yaml
apply:
tags:
- preflight
- binary_checks
tags:
- preflight
- binary_checks
- name: Preflight Check, AI Service - Set up Authentication Headers if needed
when: assisted_service_authentication != "none"
ansible.builtin.include_tasks:
file: tasks/ai-svc/setup_auth_headers.yaml
apply:
tags:
- preflight
- ai_svc_setup_headers
tags:
- preflight
- ai_svc_setup_headers
- name: Preflight Check, AI Service - Version Checks
ansible.builtin.include_tasks:
file: tasks/ai-svc/query_openshift_versions.yaml
apply:
tags:
- preflight
- ai_svc_query_versions
tags:
- preflight
- ai_svc_query_versions
# =========================================================================================================================
# Preflight Infrastructure Connection Tests
# =========================================================================================================================
- name: Preflight Check - Per cluster_node Bare Metal Connection Test
when: node_item.infra.type == "baremetal"
ansible.builtin.include_tasks:
file: tasks/preflight/conntest_baremetal_nodes.yaml
apply:
tags:
- preflight
- conntests
- conntest_baremetal
tags:
- preflight
- conntests
- conntest_baremetal
loop: "{{ cluster_nodes }}"
loop_control:
loop_var: node_item
label: "{{ node_item.name }}"
- name: Preflight Check - Libvirt Connection Test
when: provider.type == "libvirt"
ansible.builtin.include_tasks:
file: tasks/preflight/conntest_libvirt.yaml
apply:
tags:
- preflight
- conntests
- conntest_libvirt
tags:
- preflight
- conntests
- conntest_libvirt
loop: "{{ infrastructure_providers }}"
loop_control:
loop_var: provider
- name: Preflight Check - Nutanix Connection Test
when: provider.type == "nutanix"
ansible.builtin.include_tasks:
file: tasks/preflight/conntest_nutanix.yaml
apply:
tags:
- preflight
- conntests
- conntest_nutanix
tags:
- preflight
- conntests
- conntest_nutanix
loop: "{{ infrastructure_providers }}"
loop_control:
loop_var: provider
- name: Preflight Check - VMWare Connection Test
when: provider.type == "vsphere"
ansible.builtin.include_tasks:
file: tasks/preflight/conntest_vmware.yaml
apply:
tags:
- preflight
- conntests
- conntest_vmware
tags:
- preflight
- conntests
- conntest_vmware
loop: "{{ infrastructure_providers }}"
loop_control:
loop_var: provider
# =========================================================================================================================
# Cluster and InfraEnv checks
# =========================================================================================================================
- name: AI Service - Check for existing cluster
ansible.builtin.uri:
headers: "{{ compiled_uri_headers }}"
url: "{{ assisted_service_endpoint }}/clusters"
return_content: true
method: GET
register: read_clusters
tags:
- ai_svc
- ai_svc_check_cluster
- ai_svc_query_clusters
- name: AI Service - Check for existing infraenvs
ansible.builtin.uri:
headers: "{{ compiled_uri_headers }}"
url: "{{ assisted_service_endpoint }}/infra-envs"
return_content: true
method: GET
register: read_infraenvs
tags:
- ai_svc
- ai_svc_check_cluster
- ai_svc_query_infraenvs
- name: Set facts if cluster exists
when: (cluster_item.base_dns_domain is defined) and ((cluster_item.base_dns_domain == cluster_domain) and (cluster_item.name == cluster_name))
ansible.builtin.set_fact:
cluster_id: "{{ cluster_item.id }}"
cluster_status: "{{ cluster_item.status }}"
loop: "{{ read_clusters.json }}"
loop_control:
loop_var: cluster_item
label: "Cluster ID: {{ cluster_item.id }}"
tags:
- ai_svc
- ai_svc_check_cluster
- ai_svc_set_cluster
- name: Set facts if infraenv exists
when: (infraenv_item.cluster_id is defined) and (infraenv_item.cluster_id == cluster_id) and (infraenv_item.name == cluster_name)
ansible.builtin.set_fact:
infraenv_id: "{{ infraenv_item.id }}"
infraenv_download_url: "{{ infraenv_item.download_url }}"
loop: "{{ read_infraenvs.json }}"
loop_control:
loop_var: infraenv_item
label: "InfraEnv ID: {{ infraenv_item.id }}"
tags:
- ai_svc
- ai_svc_check_cluster
- ai_svc_set_infraenv
- name: Create cluster ID directory
when: cluster_id != ""
ansible.builtin.file:
state: directory
path: "{{ generated_asset_directory }}/{{ cluster_id }}"
mode: '0755'
tags:
- ai_svc
- ai_svc_check_cluster
- ai_svc_create_cluster_dir
# =========================================================================================================================
# Cluster Definition
# =========================================================================================================================
- name: Create Cluster if it does not already exist
when: cluster_id == ""
block:
- name: Set random var for this deployment json run
ansible.builtin.set_fact:
deployment_name: "{{ lookup('password', '/dev/null chars=ascii_lowercase,digits length=8') }}"
- name: SSH Key Generation & Reading
ansible.builtin.include_tasks:
file: tasks/ssh_keys.yaml
apply:
tags:
- ssh_keys
tags:
- ssh_keys
- name: AI Service - Create the base cluster deployment definition
ansible.builtin.include_tasks:
file: tasks/ai-svc/create_cluster.yaml
apply:
tags:
- ai_svc
- ai_svc_create_cluster
tags:
- ai_svc
- ai_svc_create_cluster
# =========================================================================================================================
# Move resources from temporary deployment_id to cluster_id paths
# =========================================================================================================================
- name: Set Cluster Configuration
when: deployment_name != ""
block:
- name: Create Cluster Asset Generation Directory
ansible.builtin.file:
path: "{{ generated_asset_directory }}/{{ cluster_id }}"
state: directory
mode: '0755'
tags:
- create_cluster_dir
- name: Copy deployment file into cluster directory
ansible.builtin.copy:
remote_src: true
src: "{{ generated_asset_directory }}/deployment-{{ deployment_name }}.json"
dest: "{{ generated_asset_directory }}/{{ cluster_id }}/deployment.json"
mode: '0644'
- name: Remove old named deployment.json
ansible.builtin.file:
path: "{{ generated_asset_directory }}/deployment-{{ deployment_name }}.json"
state: absent
- name: SSH Key Migration & Reread
ansible.builtin.include_tasks:
file: tasks/ssh_keys.yaml
apply:
tags:
- ssh_keys
tags:
- ssh_keys
# =========================================================================================================================
# Create InfraEnv
# =========================================================================================================================
- name: AI Service - Create the infraenv if it does not already exist
when: infraenv_id == ""
tags:
- ai_svc
- ai_svc_create_infraenv
block:
- name: Create the infraenv deployment definition
ansible.builtin.include_tasks:
file: tasks/ai-svc/create_infraenv.yaml
apply:
tags:
- ai_svc
- ai_svc_create_infraenv
# =========================================================================================================================
# Perform additional Assisted Installer Configuration steps
# =========================================================================================================================
- name: Do cluster configuration things
when: cluster_status in ["insufficient", "ready", "pending-for-input", "adding-hosts"]
tags:
- ai_svc
- ai_configure_cluster
block:
- name: AI Service - Inject extra manifests
when: injected_manifests is defined
ansible.builtin.include_tasks:
file: tasks/ai-svc/preconfig_extra_manifests.yaml
apply:
tags:
- ai_svc
- ai_configure_cluster
- ai_svc_inject_extra_manifests
tags:
- ai_svc_inject_extra_manifests
- name: AI Service - Patch in Cluster Preconfiguration for Networking
ansible.builtin.include_tasks:
file: tasks/ai-svc/preconfig_networking.yaml
apply:
tags:
- ai_svc
- ai_configure_cluster
- ai_svc_preconfig_networking
tags:
- ai_svc_preconfig_networking
- name: AI Service - Inject Cilium Networking Cluster Manifests
when: cluster_network_type == "Cilium"
ansible.builtin.include_tasks:
file: tasks/ai-svc/networking_cilium.yaml
apply:
tags:
- ai_svc
- ai_configure_cluster
- ai_svc_inject_cilium_manifests
tags:
- ai_svc_inject_cilium_manifests
- name: AI Service - Inject Calico Networking Cluster Manifests
when: cluster_network_type == "Calico"
ansible.builtin.include_tasks:
file: tasks/ai-svc/networking_calico.yaml
apply:
tags:
- ai_svc
- ai_configure_cluster
- ai_svc_inject_calico_manifests
tags:
- ai_svc_inject_calico_manifests
- name: AI Service - Add Additional Root CAs to the Discovery ISO
when: additionalTrustBundle is defined
ansible.builtin.include_tasks:
file: tasks/ai-svc/add_additionalTrustBundle_to_infraenv.yaml
apply:
tags:
- ai_svc
- ai_configure_cluster
- ai_svc_add_additionalTrustBundle_to_infraenv
tags:
- ai_svc_add_additionalTrustBundle_to_infraenv
- name: AI Service - Patch the proxy configuration
when: cluster_proxy is defined
ansible.builtin.include_tasks:
file: tasks/ai-svc/add_proxy_config.yaml
apply:
tags:
- ai_svc
- ai_configure_cluster
- ai_svc_add_proxy_config
tags:
- ai_svc_add_proxy_config
- name: AI Service - Patch the Mirror Registry configuration
when: imageContentSources is defined
ansible.builtin.include_tasks:
file: tasks/ai-svc/configure_mirror_registry.yaml
apply:
tags:
- ai_svc
- ai_configure_cluster
- ai_svc_configure_mirror_registry
tags:
- ai_svc_configure_mirror_registry
- name: AI Service - Patch the NTP configuration
when: ntp_sources is defined
ansible.builtin.include_tasks:
file: tasks/ai-svc/add_ntp_config.yaml
apply:
tags:
- ai_svc
- ai_configure_cluster
- ai_svc_add_ntp_config
tags:
- ai_svc_add_ntp_config
- name: Set the core user password
when: core_user_password is defined
ansible.builtin.include_tasks:
file: tasks/ai-svc/set_core_user_pass_as_ico.yaml
apply:
tags:
- ai_svc
- ai_configure_cluster
- ai_svc_set_core_user_password
tags:
- ai_svc_set_core_user_password
- name: Patch the install-config overrides
when: additionalTrustBundle is defined or cluster_proxy is defined or ntp_sources is defined or core_user_password is defined
ansible.builtin.include_tasks:
file: tasks/ai-svc/set_install_config_overrides.yaml
apply:
tags:
- ai_svc
- ai_configure_cluster
- ai_svc_set_install_config_overrides
tags:
- ai_svc_set_install_config_overrides
- name: AI Service - Add Ignition Config Overrides
when: (passwd_ico_object is defined) or (ignition_config_override_files is defined)
# when: (passwd_ico_object is defined) or (ignition_config_override_files is defined and ignition_config_override_files | length > 0)
ansible.builtin.include_tasks:
file: tasks/ai-svc/set_ignition_config_overrides.yaml
apply:
tags:
- ai_svc
- ai_configure_cluster
- ai_svc_set_ignition_config_overrides
tags:
- ai_svc_set_ignition_config_overrides
- name: AI Service - Reconfigure ISO Parameters
ansible.builtin.include_tasks:
file: tasks/ai-svc/configure_iso_params.yaml
apply:
tags:
- ai_svc
- ai_configure_cluster
- ai_svc_configure_iso_params
tags:
- ai_svc_configure_iso_params
#- name: Set the core user password
# when: core_user_password is defined
# block:
# - name: Reconfigure the Discovery ISO Ignition with the core user password
# ansible.builtin.include_tasks:
# file: tasks/ai-svc/set_core_user_password.yaml
# apply:
# tags:
# - ai_svc_set_core_user_password
#
# - name: AI Service - Reconfigure ISO Parameters
# ansible.builtin.include_tasks:
# file: tasks/ai-svc/configure_iso_params.yaml
# apply:
# tags:
# - ai_svc_configure_iso_params
# - ai_svc_set_core_user_password
# tags:
# - ai_svc_configure_iso_params
# tags:
# - ai_svc_set_core_user_password
# =========================================================================================================================
# Downloading of the Discovery ISO
# =========================================================================================================================
- name: Download ISO if needed
tags:
- download_iso
block:
- name: Check for existing ISO
ansible.builtin.stat:
path: "{{ generated_asset_directory }}/{{ cluster_id }}/ocp_ai.iso"
register: iso_check
tags:
- check_for_local_iso
# This is wrapped in a block/rescue cause evidently auth request limits can be reached
- name: Download Discovery ISO
when: not iso_check.stat.exists
block:
- name: Pull OpenShift ISO if needed
tags:
- ai_svc
- ai_svc_download_iso
ansible.builtin.get_url:
headers: "{{ compiled_uri_headers }}"
url: "{{ infraenv_download_url }}"
dest: "{{ generated_asset_directory }}/{{ cluster_id }}/ocp_ai.iso"
mode: '0644'
register: pull_result
until: pull_result.status_code is defined and pull_result.status_code in [201, 200, 302, 304]
retries: 10
delay: 10
rescue:
- name: Pull info again
ansible.builtin.uri:
headers: "{{ compiled_uri_headers }}"
url: "{{ assisted_service_endpoint }}/clusters/{{ cluster_id }}"
return_content: true
method: GET
status_code: 200
body_format: json
register: cluster_install_statuscheck
failed_when: false
- name: Resync auth headers
when: cluster_install_statuscheck.status == 401
block:
- name: Set up Authentication Headers if needed
when: assisted_service_authentication != "none"
ansible.builtin.include_tasks: tasks/ai-svc/setup_auth_headers.yaml
- name: Pull OpenShift ISO if needed
tags:
- ai_svc
- ai_svc_download_iso
ansible.builtin.get_url:
headers: "{{ compiled_uri_headers }}"
url: "{{ infraenv_download_url }}"
dest: "{{ generated_asset_directory }}/{{ cluster_id }}/ocp_ai.iso"
mode: '0644'
register: pull_result
until: pull_result.status_code is defined and pull_result.status_code in [201, 200, 302, 304]
retries: 10
delay: 10
# =========================================================================================================================
# Local HTTP Server
# =========================================================================================================================
- name: Start a local HTTP Server to serve the ISO in the background
when: deploy_local_http_server | bool
ansible.builtin.include_tasks:
file: tasks/infra-baremetal/start_local_server.yaml
apply:
tags:
- start_local_server
tags:
- start_local_server
# =========================================================================================================================
# Infrastructure-specific Creation Tasks - Bare Metal
# =========================================================================================================================
- name: Create the list of Bare Metal targeted hosts
when: node_item.infra.type == "baremetal"
ansible.builtin.set_fact:
baremetal_hosts: "{{ baremetal_hosts | default([]) + [node_item] }}"
unique_baremetal_infra_providers: []
loop: "{{ cluster_nodes }}"
loop_control:
loop_var: node_item
tags:
- create_infra
- infra_baremetal
- infra_baremetal_create_hosts_list
- name: Create the list of unique Bare Metal infrastructure providers
when: baremetal_hosts is defined and baremetal_hosts | length > 0
ansible.builtin.include_tasks:
file: tasks/infra-baremetal/get_unique_providers.yaml
apply:
tags:
- create_infra
- infra_baremetal
- infra_baremetal_create_infra_list
loop: "{{ baremetal_hosts }}"
loop_control:
loop_var: node_item
tags:
- create_infra
- infra_baremetal
- infra_baremetal_create_infra_list
- name: Create the Bare Metal infrastructure
when:
- baremetal_hosts is defined
- baremetal_hosts | length > 0
- unique_baremetal_infra_providers | length > 0
tags:
- create_infra
- infra_baremetal
- infra_baremetal_create_infra
block:
# - name: Perform per Bare Metal Infrastructure Provider set up
# ansible.builtin.include_tasks: tasks/infra-baremetal/per_provider_setup.yaml
# loop: "{{ unique_baremetal_infra_providers }}"
# loop_control:
# loop_var: provider
# label: "Bare Metal Infrastructure Provider: {{ provider.name }}"
# tags:
# - infra_baremetal_per_provider_setup
- name: Deploy Bare Metal infrastructure
ansible.builtin.include_tasks:
file: tasks/infra-baremetal/create.yaml
apply:
tags:
- create_infra
- infra_baremetal
- infra_baremetal_create_infra
loop: "{{ baremetal_hosts }}"
loop_control:
loop_var: node_item
label: "Bare Metal Host: {{ node_item.name }}"
- name: Wait for other bare metal hosts to be manually added
when: baremetal_wait_for_manual_hosts is defined and baremetal_wait_for_manual_hosts | bool
tags:
- create_infra
- infra_baremetal
- infra_baremetal_wait_for_other_hosts
ansible.builtin.pause:
prompt: "\nDownload the ISO from the Assisted Installer Service and boot your bare metal hosts.\nIt can also be found locally at {{ generated_asset_directory }}/{{ cluster_id }}/ocp_ai.iso\n\nPress [ENTER] to continue"
# =========================================================================================================================
# Infrastructure-specific Creation Tasks - Libvirt
# =========================================================================================================================
- name: Create the list of Libvirt targeted hosts
when: node_item.infra.type == "libvirt"
ansible.builtin.set_fact:
libvirt_hosts: "{{ libvirt_hosts | default([]) + [node_item] }}"
unique_libvirt_infra_providers: []
loop: "{{ cluster_nodes }}"
loop_control:
loop_var: node_item
tags:
- create_infra
- infra_libvirt
- infra_libvirt_create_hosts_list
- name: Create the list of unique Libvirt infrastructure providers
when: libvirt_hosts is defined and libvirt_hosts | length > 0
ansible.builtin.include_tasks:
file: tasks/infra-libvirt/get_unique_providers.yaml
apply:
tags:
- create_infra
- infra_libvirt
- infra_libvirt_create_infra_list
loop: "{{ libvirt_hosts }}"
loop_control:
loop_var: node_item
tags:
- create_infra
- infra_libvirt
- infra_libvirt_create_infra_list
- name: Create the Libvirt infrastructure
when:
- libvirt_hosts is defined
- libvirt_hosts | length > 0
- unique_libvirt_infra_providers | length > 0
tags:
- create_infra
- infra_libvirt
- infra_libvirt_create_infra
block:
- name: Perform per Libvirt Infrastructure Provider set up
ansible.builtin.include_tasks:
file: tasks/infra-libvirt/per_provider_setup.yaml
apply:
tags:
- create_infra
- infra_libvirt
- infra_libvirt_create_infra
- infra_libvirt_per_provider_setup
loop: "{{ unique_libvirt_infra_providers }}"
loop_control:
loop_var: provider
label: "Libvirt Infrastructure Provider: {{ provider.name }}"
tags:
- infra_libvirt_per_provider_setup
- name: Deploy Libvirt infrastructure
ansible.builtin.include_tasks:
file: tasks/infra-libvirt/create.yaml
apply:
tags:
- create_infra
- infra_libvirt
- infra_libvirt_create_infra
loop: "{{ libvirt_hosts }}"
loop_control:
loop_var: node_item
label: "Libvirt Host: {{ node_item.name }}"
# =========================================================================================================================
# Infrastructure-specific Creation Tasks - Nutanix
# =========================================================================================================================
- name: Create the list of Nutanix targeted hosts
when: node_item.infra.type == "nutanix"
ansible.builtin.set_fact:
nutanix_hosts: "{{ nutanix_hosts | default([]) + [node_item] }}"
unique_nutanix_infra_providers: []
loop: "{{ cluster_nodes }}"
loop_control:
loop_var: node_item
tags:
- create_infra
- infra_nutanix
- infra_nutanix_create_hosts_list
- name: Create the list of unique Nutanix infrastructure providers
when: nutanix_hosts is defined and nutanix_hosts | length > 0
ansible.builtin.include_tasks:
file: tasks/infra-nutanix/get_unique_providers.yaml
apply:
tags:
- create_infra
- infra_nutanix
- infra_nutanix_create_infra_list
loop: "{{ nutanix_hosts }}"
loop_control:
loop_var: node_item
tags:
- create_infra
- infra_nutanix
- infra_nutanix_create_infra_list
- name: Create the Nutanix infrastructure
when:
- nutanix_hosts is defined
- nutanix_hosts | length > 0
- unique_nutanix_infra_providers | length > 0
tags:
- create_infra
- infra_nutanix
- infra_nutanix_create_infra
block:
- name: Perform per Nutanix Infrastructure Provider set up
ansible.builtin.include_tasks:
file: tasks/infra-nutanix/per_provider_setup.yaml
apply:
tags:
- create_infra
- infra_nutanix
- infra_nutanix_create_infra
- infra_nutanix_per_provider_setup
loop: "{{ unique_nutanix_infra_providers }}"
loop_control:
loop_var: provider
label: "Nutanix Infrastructure Provider: {{ provider.name }}"
tags:
- create_infra
- infra_nutanix_per_provider_setup
- name: Deploy Nutanix infrastructure
ansible.builtin.include_tasks:
file: tasks/infra-nutanix/create.yaml
apply:
tags:
- create_infra
- infra_nutanix
- infra_nutanix_create_infra
loop: "{{ nutanix_hosts }}"
loop_control:
loop_var: node_item
label: "Nutanix Host: {{ node_item.name }}"
# =========================================================================================================================
# Infrastructure-specific Creation Tasks - vSphere
# =========================================================================================================================
- name: Create the list of vSphere targeted hosts
when: node_item.infra.type == "vsphere"
ansible.builtin.set_fact:
vsphere_hosts: "{{ vsphere_hosts | default([]) + [node_item] }}"
unique_vsphere_infra_providers: []
loop: "{{ cluster_nodes }}"
loop_control:
loop_var: node_item
tags:
- create_infra
- infra_vsphere
- infra_vsphere_create_hosts_list
- name: Create the list of unique vSphere infrastructure providers
when: vsphere_hosts is defined and vsphere_hosts | length > 0
ansible.builtin.include_tasks:
file: tasks/infra-vsphere/get_unique_providers.yaml
apply:
tags:
- create_infra
- infra_vsphere
- infra_vsphere_create_infra_list
loop: "{{ vsphere_hosts }}"
loop_control:
loop_var: node_item
tags:
- create_infra
- infra_vsphere
- infra_vsphere_create_infra_list
- name: Create the vSphere infrastructure
when:
- vsphere_hosts is defined
- vsphere_hosts | length > 0
- unique_vsphere_infra_providers | length > 0
tags:
- create_infra
- infra_vsphere
- infra_vsphere_create_infra
block:
- name: Perform per vSphere Infrastructure Provider set up
ansible.builtin.include_tasks:
file: tasks/infra-vsphere/per_provider_setup.yaml
apply:
tags:
- create_infra
- infra_vsphere
- infra_vsphere_create_infra
- infra_vsphere_per_provider_setup
loop: "{{ unique_vsphere_infra_providers }}"
loop_control:
loop_var: provider
label: "vSphere Infrastructure Provider: {{ provider.name }}"
tags:
- create_infra
- infra_vsphere_per_provider_setup
- name: Deploy vSphere infrastructure
ansible.builtin.include_tasks:
file: tasks/infra-vsphere/create.yaml
apply:
tags:
- create_infra
- infra_vsphere
- infra_vsphere_create_infra
- infra_vsphere_deploy_infra
loop: "{{ vsphere_hosts }}"
loop_control:
loop_var: node_item
label: "vSphere Host: {{ node_item.name }}"
tags:
- create_infra
- infra_vsphere_deploy_infra
# =========================================================================================================================
# AI Service - Configure Cluster
# =========================================================================================================================
- name: Wait for hosts to report into the Assisted Installer service
ansible.builtin.include_tasks:
file: tasks/ai-svc/check_for_hosts.yaml
apply:
tags:
- ai_svc
- ai_svc_post_infra
- ai_svc_wait_for_hosts
tags:
- ai_svc
- ai_svc_post_infra
- ai_svc_wait_for_hosts
- name: Set Host Ignition Configs
ansible.builtin.include_tasks:
file: tasks/ai-svc/set_host_pointer_ignition.yaml
apply:
tags:
- ai_svc
- ai_svc_post_infra
- ai_svc_set_host_pointer_ignition
tags:
- ai_svc
- ai_svc_post_infra
- ai_svc_set_host_pointer_ignition
- name: Set Host Names and Roles for Standard HA OpenShift Cluster
ansible.builtin.include_tasks:
file: tasks/ai-svc/set_host_names_roles.yaml
apply:
tags:
- ai_svc
- ai_svc_post_infra
- ai_svc_set_host_names_roles
# when: cluster_type == "Standard"
tags:
- ai_svc
- ai_svc_post_infra
- ai_svc_set_host_names_roles
- name: Set Network VIPs
when: cluster_type != "SNO"
ansible.builtin.include_tasks:
file: tasks/ai-svc/set_vips.yaml
apply:
tags:
- ai_svc
- ai_svc_post_infra
- ai_svc_set_vips
tags:
- ai_svc
- ai_svc_post_infra
- ai_svc_set_vips
# =========================================================================================================================
# AI Service - Start Cluster Install
# =========================================================================================================================
- name: Check to make sure the hosts are ready and the cluster can be installed
ansible.builtin.include_tasks:
file: tasks/ai-svc/check_install_ready.yaml
apply:
tags:
- ai_svc
- ai_svc_post_infra
- ai_svc_check_install_ready
tags:
- ai_svc
- ai_svc_post_infra
- ai_svc_check_install_ready
- name: Start the Cluster installation
ansible.builtin.include_tasks:
file: tasks/ai-svc/start_install.yaml
apply:
tags:
- ai_svc
- ai_svc_post_infra
- ai_svc_start_install
tags:
- ai_svc
- ai_svc_post_infra
- ai_svc_start_install
# =========================================================================================================================
# AI Service - Wait for Installation to complete
# =========================================================================================================================
- name: Wait for the cluster to be fully installed