forked from Azure/sap-automation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaybook_04_00_00_db_install.yaml
More file actions
1057 lines (916 loc) · 51.9 KB
/
playbook_04_00_00_db_install.yaml
File metadata and controls
1057 lines (916 loc) · 51.9 KB
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
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
---
# /*----------------------------------------------------------------------------8
# | |
# | Prepare for DB Install |
# | |
# +------------------------------------4--------------------------------------*/
- hosts: localhost
name: "Database Installation Playbook: - Initialization"
gather_facts: true
vars_files:
- vars/ansible-input-api.yaml # API Input template with defaults
tasks:
- name: "Database Installation Playbook: - Create Progress folder"
ansible.builtin.file:
path: "{{ _workspace_directory }}/.progress"
state: directory
mode: 0755
- name: "Database Installation Playbook: - Create Progress db folder"
ansible.builtin.file:
path: "{{ _workspace_directory }}/.progress/db"
state: directory
mode: 0755
- name: "Database Installation Playbook: - Remove db-install-done flag"
ansible.builtin.file:
path: "{{ _workspace_directory }}/.progress/db-install-done"
state: absent
- name: "Database Installation Playbook: - Set hdb fact"
ansible.builtin.set_fact:
tier: hdb
- name: "Database Installation Playbook: - Read/Create passwords"
ansible.builtin.include_role:
name: roles-misc/0.1-passwords
public: true
tags:
- 0.1-passwords
- name: "Database Installation Playbook: - Read password"
ansible.builtin.include_role:
name: roles-misc/0.1-passwords
tasks_from: windows.yaml
public: true
when: platform == "SQLSERVER"
tags:
- 0.1-win-passwords
- name: "Backward Compatibility - Check required Database HA variables"
ansible.builtin.set_fact:
database_high_availability: "{{ db_high_availability | default(false) }}"
when:
- db_high_availability is defined
- database_high_availability is not defined
- name: "Database Installation Playbook: - Read/Create key vault secrets"
ansible.builtin.include_role:
name: roles-misc/0.2-kv-secrets
public: true
vars:
# tier: fencing
operation: fencing
when: (database_high_availability and database_cluster_type == "AFA")
tags:
- 0.2-kv-secrets
- name: "Database Installation Playbook: - Read storage account details"
ansible.builtin.include_role:
name: roles-misc/0.3.sap-installation-media-storage-details
public: true
vars:
tier: bom_download
tags:
- kv-sap-installation-media-storage-details
- name: "Database Installation Playbook: - Generate root password"
ansible.builtin.set_fact:
root_password: "{{ lookup('ansible.builtin.password', '/dev/null', seed=inventory_hostname) }}"
when:
- database_scale_out is defined
- database_scale_out
register: root_password_generated
- name: "Database Installation Playbook: - Show root password"
ansible.builtin.debug:
msg: "{{ hostvars.localhost.root_password }}"
verbosity: 4
when:
- hostvars.localhost.root_password is defined
# /*----------------------------------------------------------------------------8
# | |
# | Playbook for HANA DB Install |
# | No Scale Out configuration |
# +------------------------------------4--------------------------------------*/
- hosts: "{{ sap_sid | upper }}_DB"
name: DB Installation - HANA
remote_user: "{{ orchestration_ansible_user }}"
gather_facts: true # Important to collect hostvars information
any_errors_fatal: true
vars_files:
- vars/ansible-input-api.yaml # API Input template with defaults
tasks:
# -------------------------------------+---------------------------------------8
#
# Build the list of tasks to be executed in order here.
#
# -------------------------------------+---------------------------------------8
- name: "Backward Compatibility - Check required Database HA variables"
ansible.builtin.set_fact:
database_high_availability: "{{ db_high_availability | default(false) }}"
when:
- db_high_availability is defined
- database_high_availability is not defined
- name: "Database Installation Playbook: - Install HANA"
become: true
when:
- node_tier == 'hana'
- not database_scale_out
block:
- name: "Database Installation Playbook: - Setting the DB facts"
ansible.builtin.set_fact:
tier: hdb # Actions for HANA DB Serve
main_password: "{{ hostvars.localhost.sap_password }}"
sapbits_location_base_path: "{{ hostvars.localhost.sapbits_location_base_path }}"
sapbits_sas_token: "{{ hostvars.localhost.sapbits_sas_token }}"
# Only applicable for scale out with HSR
tags:
- always
- name: "Database Installation Playbook: - Show SAP password"
ansible.builtin.debug:
msg: "{{ hostvars.localhost.sap_password }}"
verbosity: 4
- name: "Run the Database installation Playbook"
block:
- name: "Database Installation Playbook: - run HANA installation"
ansible.builtin.include_role:
name: roles-db/4.0.0-hdb-install
when:
- not database_scale_out
- name: "Database Installation Playbook: - Create db-install-done flag"
delegate_to: localhost
become: false
ansible.builtin.file:
path: "{{ _workspace_directory }}/.progress/db/db-install-done{{ ansible_hostname }}"
state: touch
mode: 0755
when:
- hana_already_installed is defined or (hana_installation.rc is defined and hana_installation.rc == 0)
always:
- name: "Database Installation Playbook: - Run post installation routines"
ansible.builtin.include_role:
name: roles-sap/7.0.0-post-install
vars:
suffix: "_DB"
tier: 'hana'
- name: "Database Installation Playbook: - Show errors from HANA installation"
ansible.builtin.debug:
msg: "{{ hana_installation.stdout_lines | select('search', 'ERROR') }}"
when:
- hana_installation is defined
- hana_installation.stdout_lines is defined
- hana_installation.rc > 0
tags:
- 4.0.0-hdb-install
- name: "Database Installation Playbook: - Install Pacemaker (base)"
become: true
when:
# - db_high_availability
- database_high_availability
- node_tier == 'hana'
- not database_scale_out
block:
- name: "Database Installation Playbook: - Setting the facts"
ansible.builtin.set_fact:
tier: ha
main_password: "{{ hostvars.localhost.sap_password }}"
password_ha_db_cluster: "{{ hostvars.localhost.db_cluster_password }}"
primary_instance_name: "{{ ansible_play_hosts_all[0] }}" # Setting up Primary Instance Name
secondary_instance_name: "{{ ansible_play_hosts_all[1] }}" # Setting up Secondary Instance Name
# fencing_spn_client_id: "{% if not use_msi_for_clusters %}{{ hostvars.localhost.sap_fencing_spn_client_id }}{% endif %}"
# fencing_spn_client_pwd: "{% if not use_msi_for_clusters %}{{ hostvars.localhost.sap_fencing_spn_pwd }}{%- endif %}"
# fencing_spn_tenant_id: "{% if not use_msi_for_clusters %}{{ hostvars.localhost.sap_fencing_spn_tenant_id }}{%- endif %}"
- name: "Database Installation Playbook: - Setting the facts for fencing"
ansible.builtin.set_fact:
fencing_spn_client_id: "{{ hostvars.localhost.sap_fencing_spn_client_id }}"
fencing_spn_client_pwd: "{{ hostvars.localhost.sap_fencing_spn_pwd }}"
fencing_spn_tenant_id: "{{ hostvars.localhost.sap_fencing_spn_tenant_id }}"
when:
- database_cluster_type == "AFA"
- not use_msi_for_clusters
- name: "Database Installation Playbook: - Ensure the correct repositories are set"
ansible.builtin.include_role:
name: roles-os/1.3-repository
tags:
- 1.3-repository
- name: "Database Installation Playbook: - Ensure the correct packages are installed"
ansible.builtin.include_role:
name: roles-os/1.4-packages
tags:
- 1.4-packages
# Setup the kernel parameters required for pacemaker cluster VMs
- name: "Database Installation Playbook: - Ensure the correct kernel parameters are set"
ansible.builtin.include_role:
name: roles-os/1.9-kernelparameters
tags:
- 1.9-kernelparameters
- name: "Database Installation Playbook: - Ensure the needed services are enabled/disabled"
ansible.builtin.include_role:
name: roles-os/1.16-services
tags:
- 1.16-services
- name: "Database Installation Playbook: - Ensure the accounts are present"
ansible.builtin.include_role:
name: roles-os/1.11-accounts
tags:
- 1.11-accounts
- name: "Database Installation Playbook: - Install Pacemaker"
ansible.builtin.include_role:
name: roles-os/1.17-generic-pacemaker # Configures the Pacemaker cluster with Azure fence agent
apply:
tags:
- 1.17-generic-pacemaker
become: true
become_user: root
when:
- node_tier != 'oracle'
- node_tier != 'oracle-asm'
tags:
- 1.17-generic-pacemaker
- name: "Database Installation Playbook: - Create pacemaker-install-done flag"
delegate_to: localhost
become: false
ansible.builtin.file:
path: "{{ _workspace_directory }}/.progress/pacemaker-install-done"
state: touch
mode: 0755
# /*----------------------------------------------------------------------------8
# | |
# | Playbook for HANA DB Install |
# | Scale Out configuration Only |
# +------------------------------------4--------------------------------------*/
# This configures HANA Scale out ( netapp and HSR shared nothing )
- hosts: "{{ sap_sid | upper }}_DB"
name: DB Installation - HANA Scale Out
remote_user: "{{ orchestration_ansible_user }}"
gather_facts: true # Important to collect hostvars information
any_errors_fatal: true
vars_files:
- vars/ansible-input-api.yaml # API Input template with defaults
tasks:
- name: "Backward Compatibility - Check required Database HA variables"
ansible.builtin.set_fact:
database_high_availability: "{{ db_high_availability | default(false) }}"
when:
- db_high_availability is defined
- database_high_availability is not defined
# This configures root account on HANA nodes for scale out configuration ( shared and shared nothing with HSR ) to use password based login.
- name: "SAP HANA: Configure root credential for Scale-Out"
block:
- name: Reset root password
become: true
ansible.builtin.user:
name: root
update_password: always
password: "{{ hostvars.localhost.root_password | password_hash('sha512') }}"
password_lock: false
- name: Enable {{ item.key }} in /etc/ssh/sshd_config
become: true
ansible.builtin.lineinfile:
path: "/etc/ssh/sshd_config"
regex: "^(# *)?{{ item.key }}"
line: "{{ item.key }} {{ item.value }}"
state: present
loop:
- { key: "PermitRootLogin", value: "yes" }
- { key: "PasswordAuthentication", value: "yes" }
- { key: "ChallengeResponseAuthentication", value: "yes" }
- name: Append root user to AllowUsers if used
become: true
ansible.builtin.lineinfile:
path: "/etc/ssh/sshd_config"
regexp: '^AllowUsers (?!.*root.*)(.*)'
line: 'AllowUsers \g<1> root'
backrefs: true
state: present
- name: "Restart SSHD on {{ ansible_hostname }}"
become: true
ansible.builtin.service:
name: sshd
state: restarted
when:
- database_scale_out
- hostvars.localhost.root_password is defined
- name: "Database Installation Playbook: - Install HANA Scale Out"
become: true
when:
- node_tier == 'hana'
- database_scale_out
block:
- name: "Database Installation Playbook: - Setting the DB facts"
ansible.builtin.set_fact:
tier: hdb # Actions for HANA DB Serve
main_password: "{{ hostvars.localhost.sap_password }}"
sapbits_location_base_path: "{{ hostvars.localhost.sapbits_location_base_path }}"
sapbits_sas_token: "{{ hostvars.localhost.sapbits_sas_token }}"
primary_instance_name: "{{ ansible_play_hosts_all[0] }}" # Setting up Primary Instance Name
secondary_instance_name: "{{ ansible_play_hosts_all[1] | default('')}}" # Setting up Secondary Instance Name
# Only applicable for scale out with HSR
tags:
- always
- name: "Database Installation Playbook: - Setting the DB Scale Out facts"
ansible.builtin.set_fact:
root_password: "{{ hostvars.localhost.root_password }}"
when:
# - database_scale_out is defined
- database_scale_out
# - not db_high_availability
- name: "Database Installation Playbook: - Show SAP password"
ansible.builtin.debug:
msg: "{{ hostvars.localhost.sap_password }}"
verbosity: 4
- name: "Run the Database installation Playbook"
block:
- name: "Database Installation Playbook: - run HANA installation"
ansible.builtin.include_role:
name: roles-db/4.0.0-hdb-install
when:
- not database_scale_out
- name: "Database Installation Playbook: - Clear the failed state of hosts"
ansible.builtin.meta: clear_host_errors
# - name: "Database installation Playbook: - run HANA Scale-Out mounts"
# ansible.builtin.include_role:
# name: roles-sap-os/2.6-sap-mounts
# when:
# - database_scale_out | default(false) == true
- name: "Database Installation Playbook: - run HANA Scale-Out installation"
ansible.builtin.include_role:
name: roles-db/4.0.3-hdb-install-scaleout
when:
- database_scale_out
- name: "Database Installation Playbook: - Create db-install-done flag"
delegate_to: localhost
become: false
ansible.builtin.file:
path: "{{ _workspace_directory }}/.progress/db/db-install-done{{ ansible_hostname }}"
state: touch
mode: 0755
when:
- hana_already_installed is defined or (hana_installation.rc is defined and hana_installation.rc == 0)
always:
- name: "Database Installation Playbook: - Run post installation routines"
ansible.builtin.include_role:
name: roles-sap/7.0.0-post-install
vars:
suffix: "_DB"
tier: 'hana'
- name: "Database Installation Playbook: - Show errors from HANA installation"
ansible.builtin.debug:
msg: "{{ hana_installation.stdout_lines | select('search', 'ERROR') }}"
when:
- hana_installation is defined
- hana_installation.stdout_lines is defined
- hana_installation.rc > 0
tags:
- 4.0.0-hdb-install
# This disables root account on HANA nodes for scale out configuration ( shared and shared nothing with HSR ) to use password based login.
- name: "SAP HANA: disable root credential for Scale-Out"
block:
- name: Reset root password to random local value
become: true
ansible.builtin.user:
name: root
update_password: always
password: "{{ lookup('ansible.builtin.password', '/dev/null', seed=inventory_hostname) | password_hash('sha512') }}"
- name: Enable {{ item.key }} in /etc/ssh/sshd_config
become: true
ansible.builtin.lineinfile:
path: "/etc/ssh/sshd_config"
regex: "^(# *)?{{ item.key }}"
line: "{{ item.key }} {{ item.value }}"
state: present
loop:
- { key: "PermitRootLogin", value: "yes" }
- { key: "PasswordAuthentication", value: "no" }
- { key: "ChallengeResponseAuthentication", value: "no" }
- name: "Restart SSHD on {{ ansible_hostname }}"
become: true
ansible.builtin.service:
name: sshd
state: restarted
when:
- database_scale_out
- hostvars.localhost.root_password is defined
# Configure HANA Scale out Pacemaker, run on DB nodes and majority maker node ( first node if multiple are provided, rest are ignored. )
- hosts: "{{ sap_sid | upper }}_DB:
{{ sap_sid | upper }}_OBSERVER_DB"
name: DB Installation - HANA Scale Out - Pacemaker
remote_user: "{{ orchestration_ansible_user }}"
gather_facts: true # Important to collect hostvars information
any_errors_fatal: true
vars_files:
- vars/ansible-input-api.yaml # API Input template with defaults
tasks:
- name: "Database Installation Playbook: - Install Pacemaker (Scale Out)"
become: true
when:
# - db_high_availability
- db_high_availability
- node_tier in ['hana','observer']
- database_scale_out
block:
- name: "Database Installation Playbook: - Setting the facts"
ansible.builtin.set_fact:
tier: ha
main_password: "{{ hostvars.localhost.sap_password }}"
password_ha_db_cluster: "{{ hostvars.localhost.db_cluster_password }}"
primary_instance_name: "{{ ansible_play_hosts_all[0] }}" # Setting up Primary Instance Name
secondary_instance_name: "{{ ansible_play_hosts_all[1] }}" # Setting up Secondary Instance Name
# root_password: "{{ hostvars.localhost.root_password }}"
# fencing_spn_client_id: "{% if not use_msi_for_clusters %}{{ hostvars.localhost.sap_fencing_spn_client_id }}{% endif %}"
# fencing_spn_client_pwd: "{% if not use_msi_for_clusters %}{{ hostvars.localhost.sap_fencing_spn_pwd }}{%- endif %}"
# fencing_spn_tenant_id: "{% if not use_msi_for_clusters %}{{ hostvars.localhost.sap_fencing_spn_tenant_id }}{%- endif %}"
- name: "Database Installation Playbook: - Setting the facts for fencing"
ansible.builtin.set_fact:
fencing_spn_client_id: "{{ hostvars.localhost.sap_fencing_spn_client_id }}"
fencing_spn_client_pwd: "{{ hostvars.localhost.sap_fencing_spn_pwd }}"
fencing_spn_tenant_id: "{{ hostvars.localhost.sap_fencing_spn_tenant_id }}"
when:
- database_cluster_type == "AFA"
- not use_msi_for_clusters
- name: "Database Installation Playbook: - Ensure the correct repositories are set"
ansible.builtin.include_role:
name: roles-os/1.3-repository
tags:
- 1.3-repository
- name: "Database Installation Playbook: - Ensure the correct packages are installed"
ansible.builtin.include_role:
name: roles-os/1.4-packages
tags:
- 1.4-packages
# Setup the kernel parameters required for pacemaker cluster VMs
- name: "Database Installation Playbook: - Ensure the correct kernel parameters are set"
ansible.builtin.include_role:
name: roles-os/1.9-kernelparameters
tags:
- 1.9-kernelparameters
- name: "Database Installation Playbook: - Ensure the needed services are enabled/disabled"
ansible.builtin.include_role:
name: roles-os/1.16-services
tags:
- 1.16-services
- name: "Database Installation Playbook: - Ensure the accounts are present"
ansible.builtin.include_role:
name: roles-os/1.11-accounts
tags:
- 1.11-accounts
# Scale out based pacemaker task/s
- name: "Database Installation Playbook: - Install Scale Out Pacemaker"
ansible.builtin.include_role:
name: roles-os/1.18-scaleout-pacemaker # Configures the Pacemaker cluster with Azure fence agent
apply:
tags:
- 1.18-scaleout-pacemaker
become: true
become_user: root
when:
- node_tier in ['hana','observer']
- database_scale_out
tags:
- 1.18-scaleout-pacemaker
- name: "Database Installation Playbook: - Create pacemaker-install-done flag"
delegate_to: localhost
become: false
ansible.builtin.file:
path: "{{ _workspace_directory }}/.progress/pacemaker-install-done"
state: touch
mode: 0755
# /*----------------------------------------------------------------------------8
# | |
# | Playbook for Oracle DB Install
# | CREATE USERS for SAP Installation |
# | |
# +------------------------------------4--------------------------------------*/
- hosts: "{{ sap_sid | upper }}_DB"
name: DB Installation - Oracle
remote_user: "{{ orchestration_ansible_user }}"
gather_facts: false
vars_files:
- vars/ansible-input-api.yaml # API Input template with defaults
tasks:
# -------------------------------------+---------------------------------------8
#
# Build the list of tasks to be executed in order here.
#
# -------------------------------------+---------------------------------------8
- name: "Database Installation Playbook: - Install Oracle"
become: true
become_user: root
when:
- node_tier == 'oracle-multi-sid'
- platform == 'ORACLE'
block:
- name: "Database Installation Playbook: - Setting the DB facts"
ansible.builtin.set_fact:
tier: ora # Actions for Oracle DB Servers
main_password: "{{ hostvars.localhost.sap_password }}"
tags:
- always
- name: "Configure accounts for ora-msid"
ansible.builtin.include_role:
name: roles-os/1.11-accounts
# /*---------------------------------------------------------------------------8
# | |
# | Playbook for Oracle DB Install |
# | |
# +------------------------------------4--------------------------------------*/
- hosts: "{{ sap_sid | upper }}_DB"
name: DB Installation - Oracle
remote_user: "{{ orchestration_ansible_user }}"
gather_facts: false
vars_files:
- vars/ansible-input-api.yaml # API Input template with defaults
tasks:
# -------------------------------------+---------------------------------------8
#
# Build the list of tasks to be executed in order here.
#
# -------------------------------------+---------------------------------------8
- name: "Database Installation Playbook: - Install Oracle"
become: true
become_user: root
when:
- node_tier == 'oracle'
- platform == 'ORACLE'
block:
- name: "Database Installation Playbook: - Setting the DB facts"
ansible.builtin.set_fact:
tier: ora # Actions for Oracle DB Servers
main_password: "{{ hostvars.localhost.sap_password }}"
tags:
- always
- name: "Configure accounts for oracle"
ansible.builtin.include_role:
name: roles-os/1.11-accounts
- name: "Configure accounts for oracle"
ansible.builtin.include_role:
name: roles-os/1.11-accounts
- name: "Database Installation Playbook: - Check for file system mounts"
ansible.builtin.include_role:
name: roles-sap-os/2.6-sap-mounts
- name: "Database Installation Playbook: - run Oracle installer"
ansible.builtin.include_role:
name: roles-db/4.1.0-ora-install
- name: "Database Installation Playbook: - Run post installation routines"
ansible.builtin.include_role:
name: roles-sap/7.0.0-post-install
vars:
suffix: "_DB"
tier: 'oracle'
- name: "Database Installation Playbook: - Create db-install-done flag"
delegate_to: localhost
become: false
ansible.builtin.file:
path: "{{ _workspace_directory }}/.progress/db/db-install-done{{ ansible_hostname }}"
state: touch
mode: 0755
- name: "Install Oracle for MSID"
become: true
become_user: root
when:
- node_tier == 'oracle-multi-sid'
- platform == 'ORACLE'
block:
- name: Setting the DB facts for MSID
ansible.builtin.set_fact:
tier: ora # Actions for Oracle DB Servers
main_password: "{{ hostvars.localhost.sap_password }}"
tags:
- always
- name: Include 1.5.2-disk-setup-ora-multi-sid role
ansible.builtin.include_role:
name: roles-os/1.5.2-disk-setup-ora-multi-sid
- name: Check for file system mounts
ansible.builtin.include_role:
name: roles-sap-os/2.6-sap-mounts
when: node_tier == 'oracle-multi-sid'
- name: Installing Oracle
ansible.builtin.include_role:
name: roles-db/4.1.3-ora-multi-sid
when: node_tier == 'oracle-multi-sid'
- name: "Database Installation Playbook: - Create db-install-done flag"
delegate_to: localhost
become: false
ansible.builtin.file:
path: "{{ _workspace_directory }}/.progress/db/db-install-done{{ ansible_hostname }}"
state: touch
mode: 0755
# Install Oracle DB based on ASM
- name: "Install Oracle on ASM"
become: true
become_user: root
when:
- node_tier == 'oracle-asm'
- platform == 'ORACLE-ASM'
block:
- name: Setting the DB facts for ASM
ansible.builtin.set_fact:
tier: ora # Actions for Oracle DB Servers
main_password: "{{ hostvars.localhost.sap_password }}"
tags:
- always
- name: Include 1.5.1.1-disk-setup-asm-sap
ansible.builtin.include_role:
name: roles-os/1.5.1.1-disk-setup-asm-sap
- name: "OS configuration playbook: - Ensure the kernel parameters are set"
ansible.builtin.include_role:
name: roles-os/1.9-kernelparameters
tags:
- 1.9-kernelparameters
# - name: "SAP OS configuration playbook: - Configure accounts"
# ansible.builtin.include_role:
# name: roles-os/1.11-accounts
# tags:
# - 1.11-accounts
- name: "SAP OS configuration playbook: - Create SAP users/groups"
ansible.builtin.include_role:
name: roles-sap-os/2.5-sap-users
tags:
- 2.5-sap-users
- name: Mount the file systems for ASM installation
ansible.builtin.include_role:
name: roles-sap-os/2.6-sap-mounts
- name: Include 1.5.1-disk-setup-asm role
ansible.builtin.include_role:
name: roles-os/1.5.1-disk-setup-asm
- name: Check for file system mounts
ansible.builtin.include_role:
name: roles-sap-os/2.6-sap-mounts
- name: Installing Oracle ASM Grid
ansible.builtin.include_role:
name: roles-db/4.1.1-ora-asm-grid
tags: 4.1.1-ora-asm-grid
- name: Installing Oracle on ASM
ansible.builtin.include_role:
name: roles-db/4.1.2-ora-asm-db-install
- name: "Database Installation Playbook: - Create db-install-done flag"
delegate_to: localhost
become: false
ansible.builtin.file:
path: "{{ _workspace_directory }}/.progress/db/db-install-done{{ ansible_hostname }}"
state: touch
mode: 0755
# /*----------------------------------------------------------------------------8
# | |
# | Playbook for DB2 DB Install |
# | |
# +------------------------------------4--------------------------------------*/
- hosts: "{{ sap_sid| upper }}_DB[0]"
name: "DB Installation - SAP DB2"
remote_user: "{{ orchestration_ansible_user }}"
gather_facts: false
vars_files:
- vars/ansible-input-api.yaml # API Input template with defaults
tasks:
# -------------------------------------+---------------------------------------8
#
# Build the list of tasks to be executed in order here.
#
# -------------------------------------+---------------------------------------8
- name: "Backward Compatibility - Check required Database HA variables"
ansible.builtin.set_fact:
database_high_availability: "{{ db_high_availability | default(false) }}"
when:
- db_high_availability is defined
- database_high_availability is not defined
- name: "Install SAP DB2"
become: true
become_user: root
when:
- platform == 'DB2'
- not database_high_availability
block:
- name: "DB2 : Setting the DB facts"
ansible.builtin.set_fact:
tier: db2 # Actions for Oracle DB Servers
main_password: "{{ hostvars.localhost.sap_password }}"
sapbits_location_base_path: "{{ hostvars.localhost.sapbits_location_base_path }}"
sapbits_sas_token: "{{ hostvars.localhost.sapbits_sas_token }}"
bom_processing: true
tags:
- always
- name: "DB2 : Install DB2 specific packages"
ansible.builtin.include_role:
name: roles-os/1.4-packages
- name: "DB2 : Check for file system mounts"
ansible.builtin.include_role:
name: roles-sap-os/2.6-sap-mounts
- name: Installing DB2
ansible.builtin.include_role:
name: roles-db/4.2.0-db2-install
- name: "Database Installation Playbook: - Run post installation routines"
ansible.builtin.include_role:
name: roles-sap/7.0.0-post-install
vars:
suffix: "_DB"
tier: 'db2'
prefix: "{{ bom.product_ids.dblha.replace('.', '/').replace('/ABAP', '').split(':')[1] }}"
path: "INSTALL/DISTRIBUTED/ABAP/DB"
this_sid: "{{ sap_sid }}"
# /*----------------------------------------------------------------------------8
# | |
# | Playbook for DB2 DB HA Install |
# | |
# +------------------------------------4--------------------------------------*/
- hosts: "{{ sap_sid| upper }}_DB"
name: "DB Installation - SAP DB2 HA"
remote_user: "{{ orchestration_ansible_user }}"
gather_facts: false
vars_files:
- vars/ansible-input-api.yaml # API Input template with defaults
tasks:
# -------------------------------------+---------------------------------------8
#
# Build the list of tasks to be executed in order here.
#
# -------------------------------------+---------------------------------------8
- name: "Backward Compatibility - Check required Database HA variables"
ansible.builtin.set_fact:
database_high_availability: "{{ db_high_availability | default(false) }}"
when:
- db_high_availability is defined
- database_high_availability is not defined
- name: "Install SAP DB2"
become: true
become_user: root
when:
- platform == 'DB2'
- database_high_availability
- (ansible_play_hosts_all | length) >= 2
block:
- name: Setting the DB facts
ansible.builtin.set_fact:
tier: db2 # Actions for DB2 Servers
main_password: "{{ hostvars.localhost.sap_password }}"
sapbits_location_base_path: "{{ hostvars.localhost.sapbits_location_base_path }}"
sapbits_sas_token: "{{ hostvars.localhost.sapbits_sas_token }}"
bom_processing: true
primary_instance_name: "{{ ansible_play_hosts_all[0] }}" # Setting up Primary Instance Name
secondary_instance_name: "{{ ansible_play_hosts_all[1] }}" # Setting up Secondary Instance Name
tags:
- always
- name: "DB2 Installation Play: Install DB2 specific packages"
ansible.builtin.include_role:
name: roles-os/1.4-packages
- name: "DB2 Installation Play: Check for file system mounts"
ansible.builtin.include_role:
name: roles-sap-os/2.6-sap-mounts
- name: "DB2 Installation Play: Installing DB2"
ansible.builtin.include_role:
name: roles-db/4.2.1-db2-hainstall
- name: "DB2 Installation Play: : - Run post installation routines"
ansible.builtin.include_role:
name: roles-sap/7.0.0-post-install
vars:
suffix: "_DB"
tier: 'db2'
prefix: "{{ bom.product_ids.dblha.replace('.', '/').replace('/' + db2_instance_type, '').split(':')[1] }}"
path: "INSTALL/DISTRIBUTED/{{ db2_instance_type }}/DB"
this_sid: "{{ sap_sid }}"
# /*----------------------------------------------------------------------------8
# | |
# | Playbook for ASE DB Install |
# | |
# +------------------------------------4--------------------------------------*/
- hosts: "{{ sap_sid| upper }}_DB[0]"
name: "DB Installation - SAP ASE"
remote_user: "{{ orchestration_ansible_user }}"
gather_facts: false
vars_files:
- vars/ansible-input-api.yaml # API Input template with defaults
tasks:
# -------------------------------------+---------------------------------------8
#
# Build the list of tasks to be executed in order here.
#
# -------------------------------------+---------------------------------------8
- name: "Backward Compatibility - Check required Database HA variables"
ansible.builtin.set_fact:
database_high_availability: "{{ db_high_availability | default(false) }}"
when:
- db_high_availability is defined
- database_high_availability is not defined
- name: "Install SAP ASE"
become: true
become_user: root
when:
- platform == 'SYBASE'
- not database_high_availability
block:
- name: "ASE Installation Play: Setting the DB facts"
ansible.builtin.set_fact:
tier: sybase
main_password: "{{ hostvars.localhost.sap_password }}"
sapbits_location_base_path: "{{ hostvars.localhost.sapbits_location_base_path }}"
sapbits_sas_token: "{{ hostvars.localhost.sapbits_sas_token }}"
bom_processing: true
sa_enabled: true
tags:
- always
- name: "ASE Installation Play: Install ASE specific packages"
ansible.builtin.include_role:
name: roles-os/1.4-packages
- name: "ASE Installation Play: Check for file system mounts"
ansible.builtin.include_role:
name: roles-sap-os/2.6-sap-mounts
- name: "ASE Installation Play: Installing ASE"
ansible.builtin.include_role:
name: roles-db/4.3.0-ase-install
- name: "ASE Installation Play: Run post installation routines"
ansible.builtin.include_role:
name: roles-sap/7.0.0-post-install
vars:
suffix: "_DB"
prefix: "{{ bom.product_ids.dbl.replace('.', '/').replace('/ABAP', '').split(':')[1] }}"
path: "INSTALL/DISTRIBUTED/ABAP/DB"
tier: 'sybase'
this_sid: "{{ sap_sid | upper }}"
work_log_component_name: "ASE{{ db_instance_number }}"
# /*----------------------------------------------------------------------------8
# | |
# | Playbook for SQL Server Install on Windows |
# | |
# +------------------------------------4--------------------------------------*/
- hosts: "{{ sap_sid | upper }}_DB"
name: DB Installation - SQLSERVER
remote_user: "{{ orchestration_ansible_user }}"
gather_facts: false
vars_files:
- vars/ansible-input-api.yaml # API Input template with defaults
tasks:
# -------------------------------------+---------------------------------------8
#
# Build the list of tasks to be executed in order here.
#
# -------------------------------------+---------------------------------------8
- name: "Database Installation Playbook: - Install SQL Server on Windows"
when:
- platform == 'SQLSERVER'
- node_tier == 'sqlserver'
block:
- name: "Database Installation Playbook: - Setting the DB facts"
ansible.builtin.set_fact:
tier: sqlserver # Actions for sql Servers
main_password: "{{ hostvars.localhost.sap_password }}"
config_tier: "sqlserver"
tags:
- always
- name: "DBLoad Playbook: - Ensure Sharing Data Folder"
ansible.builtin.include_role:
name: roles-sap-os/windows/2.3-sap-exports
- name: "Database Installation Playbook: - Run SQL Server Installation"
ansible.builtin.include_role:
name: roles-db/windows/4.4.0-mssql-install
vars:
domain_user_password: "{{ hostvars.localhost.winadm_password }}"
- name: "Database Installation Playbook: - Create db-install-done flag"
delegate_to: localhost
become: false
ansible.builtin.file:
path: "{{ _workspace_directory }}/.progress/db/db-install-done{{ ansible_hostname }}"
state: touch
mode: 0755
vars:
become_user: "{{ become_user_name }}"