diff --git a/data/sles4sap/sap_deployment_automation_framework/SAP_SYSTEM.tfvars b/data/sles4sap/sap_deployment_automation_framework/SAP_SYSTEM.tfvars index cc8c5cb20fa7..1c8139211dd6 100644 --- a/data/sles4sap/sap_deployment_automation_framework/SAP_SYSTEM.tfvars +++ b/data/sles4sap/sap_deployment_automation_framework/SAP_SYSTEM.tfvars @@ -155,7 +155,7 @@ database_platform = "HANA" database_server_count = 1 # database_high_availability is a boolean flag controlling if the database tier is deployed highly available (more than 1 node) -database_high_availability = true +database_high_availability = "%SDAF_HANA_HA_SETUP%" # For M series VMs use the SKU name for instance "M32ts" # If using a custom disk sizing populate with the node name for Database you have used in the file custom_disk_sizes_filename @@ -232,13 +232,13 @@ database_vm_use_DHCP = true # in this case os_type must also be specified database_vm_image = { - os_type = "%SDAF_DB_IMAGE_OS_TYPE%", - source_image_id = "%SDAF_DB_SOURCE_IMAGE_ID%", - publisher = "%SDAF_DB_IMAGE_PUBLISHER%", - offer = "%SDAF_DB_IMAGE_OFFER%", - sku = "%SDAF_DB_IMAGE_SKU%", - version = "%SDAF_DB_IMAGE_VERSION%", - type = "%SDAF_DB_IMAGE_TYPE%" + os_type = "%SDAF_IMAGE_OS_TYPE%", + source_image_id = "%SDAF_SOURCE_IMAGE_ID%", + publisher = "%SDAF_IMAGE_PUBLISHER%", + offer = "%SDAF_IMAGE_OFFER%", + sku = "%SDAF_IMAGE_SKU%", + version = "%SDAF_IMAGE_VERSION%", + type = "%SDAF_IMAGE_TYPE%" } # database_vm_zones is an optional list defining the availability zones to deploy the database servers @@ -285,10 +285,10 @@ sid = "%SAP_SID%" ######################################################################################### # scs_server_count defines how many SCS servers to deploy -scs_server_count = "0" +scs_server_count = "%SDAF_ASCS_SERVER%" # scs_high_availability is a boolean flag controlling if SCS should be highly available -scs_high_availability = false +scs_high_availability = "%SDAF_ERS_SERVER%" # scs_instance_number defines the instance number for SCS scs_instance_number = "01" @@ -301,7 +301,7 @@ pas_instance_number = "03" # scs_server_zones is an optional list defining the availability zones to which deploy the SCS servers -scs_server_zones = ["0"] +scs_server_zones = ["1"] # scs_server_sku, if defined provides the SKU to use for the SCS servers #scs_server_sku = "" @@ -310,13 +310,13 @@ scs_server_zones = ["0"] # if source_image_id is specified the deployment will use the custom image provided, # in this case os_type must also be specified scs_server_image = { - os_type = "LINUX", - source_image_id = "", - publisher = "SUSE", - offer = "sles-sap-15-sp5", - sku = "gen2", - version = "latest", - type = "marketplace" + os_type = "%SDAF_IMAGE_OS_TYPE%", + source_image_id = "%SDAF_SOURCE_IMAGE_ID%", + publisher = "%SDAF_IMAGE_PUBLISHER%", + offer = "%SDAF_IMAGE_OFFER%", + sku = "%SDAF_IMAGE_SKU%", + version = "%SDAF_IMAGE_VERSION%", + type = "%SDAF_IMAGE_TYPE%" } # scs_server_use_ppg defines the that the SCS virtual machines will be placed in a proximity placement group @@ -351,10 +351,10 @@ scs_server_use_avset = false ######################################################################################### # application_server_count defines how many application servers to deploy -application_server_count = 0 +application_server_count = "%SDAF_APP_SERVER_COUNT%" # application_server_zones is an optional list defining the availability zones to which deploy the application servers -application_server_zones = ["0"] +application_server_zones = ["1"] # application_server_sku, if defined provides the SKU to use for the application servers #application_server_sku = "" @@ -393,13 +393,13 @@ application_server_use_avset = true # if source_image_id is specified the deployment will use the custom image provided, # in this case os_type must also be specified application_server_image = { - os_type = "LINUX", - source_image_id = "", - publisher = "SUSE", - offer = "sles-sap-15-sp4", - sku = "gen2", - version = "latest", - type = "marketplace" + os_type = "%SDAF_IMAGE_OS_TYPE%", + source_image_id = "%SDAF_SOURCE_IMAGE_ID%", + publisher = "%SDAF_IMAGE_PUBLISHER%", + offer = "%SDAF_IMAGE_OFFER%", + sku = "%SDAF_IMAGE_SKU%", + version = "%SDAF_IMAGE_VERSION%", + type = "%SDAF_IMAGE_TYPE%" } #application_server_vm_avset_arm_ids = [] @@ -449,7 +449,7 @@ webdispatcher_server_use_avset = false #webdispatcher_server_tags = {} # webdispatcher_server_zones is an optional list defining the availability zones to which deploy the web dispatchers -#webdispatcher_server_zones = ["0"] +#webdispatcher_server_zones = ["1"] # The vm_image defines the Virtual machine image to use for the web dispatchers, # if source_image_id is specified the deployment will use the custom image provided, @@ -498,9 +498,9 @@ dns_a_records_for_secondary_names = true # AFS indicates that Azure Files for NFS is used # ANF indicates that Azure NetApp Files is used # NFS indicates that a custom solution is used for NFS -NFS_provider = "NFS" +NFS_provider = "AFS" # sapmnt_volume_size defines the size of the sapmnt volume in GB -sapmnt_volume_size = 32 +sapmnt_volume_size = 128 # azure_files_sapmnt_id defines the Resource identifier for Azure Files for NFS storage account for sapmnt #azure_files_sapmnt_id = "" @@ -854,7 +854,7 @@ use_spn = true # bom_name is the name of the SAP Application Bill of Materials file -bom_name = "HANA_2_00_075_v0001ms" +bom_name = "%SDAF_BOM_NAME%" # configuration_settings is a dictionary containing values that will be persisted in sap-parameters.yaml #configuration_settings = {} diff --git a/data/sles4sap/sap_deployment_automation_framework/WORKLOAD_ZONE.tfvars b/data/sles4sap/sap_deployment_automation_framework/WORKLOAD_ZONE.tfvars index e0d74348c71a..77f15c050dfa 100644 --- a/data/sles4sap/sap_deployment_automation_framework/WORKLOAD_ZONE.tfvars +++ b/data/sles4sap/sap_deployment_automation_framework/WORKLOAD_ZONE.tfvars @@ -77,7 +77,7 @@ use_service_endpoint = true peer_with_control_plane_vnet = true # Defines if access to the key vaults and storage accounts is restricted to the SAP and deployer VNets -enable_firewall_for_keyvaults_and_storage = false +enable_firewall_for_keyvaults_and_storage = true # Defines if public access is allowed for the storage accounts and key vaults public_network_access_enabled = true diff --git a/lib/sles4sap/sap_deployment_automation_framework/configure_tfvars.pm b/lib/sles4sap/sap_deployment_automation_framework/configure_tfvars.pm index 5d1ef7da2878..fdea7527e64a 100644 --- a/lib/sles4sap/sap_deployment_automation_framework/configure_tfvars.pm +++ b/lib/sles4sap/sap_deployment_automation_framework/configure_tfvars.pm @@ -56,8 +56,15 @@ sub prepare_tfvars_file { workload_zone => data_url('sles4sap/sap_deployment_automation_framework/WORKLOAD_ZONE.tfvars'), library => data_url('sles4sap/sap_deployment_automation_framework/LIBRARY.tfvars') ); - # Parameters required for defining DB VM image for SAP systems deployment - set_db_image_parameters() if $args{deployment_type} eq 'sap_system'; + if ($args{deployment_type} eq 'sap_system') { + # Parameters required for defining DB VM image for SAP systems deployment + set_image_parameters(); + # Parameters required for Hana DB HA scenario + set_hana_db_parameters(); + # Netweaver related parameters + set_netweaver_parameters(); + } + # replace default vnet name with shorter one to avoid naming restrictions set_workload_vnet_name(); @@ -70,6 +77,8 @@ sub prepare_tfvars_file { return $tfvars_file; } + + =head2 replace_tfvars_variables replace_tfvars_variables('/path/to/file.tfvars'); @@ -87,7 +96,7 @@ If OpenQA variable is not set, placeholder is replaced with empty value. sub replace_tfvars_variables { my ($tfvars_file) = @_; croak 'Variable "$tfvars_file" undefined' unless defined($tfvars_file); - my @variables = split("\n", script_output("grep -oP \'(\?<=%)[A-Z_]+(?=%)\' $tfvars_file")); + my @variables = split("\n", script_output("grep -oP \'(\?<=%)[0-9A-Z_]+(?=%)\' $tfvars_file")); my %to_replace = map { '%' . $_ . '%' => get_var($_, '') } @variables; file_content_replace($tfvars_file, %to_replace); } @@ -116,34 +125,72 @@ sub set_workload_vnet_name { set_var('SDAF_SUT_VNET_NAME', 'OpenQA-' . $args{job_id}); } -=head2 set_vm_image_parameters +=head2 set_image_parameters - set_vm_db_image_parameters([job_id=>'123456']); - -=over - -=item * B<$job_id>: Specify job id to be used. Default: current deployment job ID - -=back + set_image_parameters(); Sets OpenQA parameters required for replacing tfvars template variables for database VM image. =cut -sub set_db_image_parameters { +sub set_image_parameters { my %params; # Parse image ID supplied by OpenQA parameter 'PUBLIC_CLOUD_IMAGE_ID' - my @variable_names = qw(SDAF_DB_IMAGE_PUBLISHER SDAF_DB_IMAGE_OFFER SDAF_DB_IMAGE_SKU SDAF_DB_IMAGE_VERSION); + my @variable_names = qw(SDAF_IMAGE_PUBLISHER SDAF_IMAGE_OFFER SDAF_IMAGE_SKU SDAF_IMAGE_VERSION); # This maps a variable name from array @variable names to value from delimited 'PUBLIC_CLOUD_IMAGE_ID' parameter # Order is important here @params{@variable_names} = split(':', get_required_var('PUBLIC_CLOUD_IMAGE_ID')); # Add all remaining parameters with static values - $params{SDAF_DB_IMAGE_OS_TYPE} = 'LINUX'; # this can be modified in case of non linux images - $params{SDAF_DB_SOURCE_IMAGE_ID} = ''; # for supplying uploaded image - not implemented yet - $params{SDAF_DB_IMAGE_TYPE} = 'marketplace'; + $params{SDAF_IMAGE_OS_TYPE} = 'LINUX'; # this can be modified in case of non linux images + $params{SDAF_SOURCE_IMAGE_ID} = ''; # for supplying uploaded image - not implemented yet + $params{SDAF_IMAGE_TYPE} = 'marketplace'; foreach (keys(%params)) { set_var($_, $params{$_}); } } + +=head2 set_hana_db_parameters + + set_hana_db_parameters(); + +Sets tfvars Database HA parameters according to scenarios defined in OpenQA parameter 'SDAF_DEPLOYMENT_SCENARIO'. + +=cut + +sub set_hana_db_parameters { + check_var_array('SDAF_DEPLOYMENT_SCENARIO', 'db_ha') + ? set_var('SDAF_HANA_HA_SETUP', 'true') : set_var('SDAF_HANA_HA_SETUP', 'false'); +} + +=head2 set_netweaver_parameters + + set_netweaver_parameters(); + +Sets tfvars Database HA parameters according to scenarios defined in OpenQA parameter 'SDAF_DEPLOYMENT_SCENARIO'. + +=cut + +sub set_netweaver_parameters { + # Default values - everything turned off + my %parameters = ( + SDAF_ASCS_SERVER => 0, + SDAF_APP_SERVER_COUNT => 0, + SDAF_ERS_SERVER => 'false' + ); + + # All nw_* scenarios require ASCS deployment + $parameters{SDAF_ASCS_SERVER} = grep /nw/, get_var('SDAF_DEPLOYMENT_SCENARIO'); + + # So far 1x PAS and 1x AAS should be enough for coverage + my $app_servers = + int(grep /pas/, get_var('SDAF_DEPLOYMENT_SCENARIO')) + int(grep /aas/, get_var('SDAF_DEPLOYMENT_SCENARIO')); + + $parameters{SDAF_APP_SERVER_COUNT} = $app_servers; + $parameters{SDAF_ERS_SERVER} = int(grep /ensa/, get_var('SDAF_DEPLOYMENT_SCENARIO')) ? 'true' : 'false'; + + for my $parameter (keys(%parameters)) { + set_var($parameter, $parameters{$parameter}); + } +} diff --git a/schedule/sles4sap/sap_deployment_automation_framework/deploy_hana_sr.yml b/schedule/sles4sap/sap_deployment_automation_framework/sdaf_deployment.yml similarity index 88% rename from schedule/sles4sap/sap_deployment_automation_framework/deploy_hana_sr.yml rename to schedule/sles4sap/sap_deployment_automation_framework/sdaf_deployment.yml index 343e8143c424..85ba40f01040 100644 --- a/schedule/sles4sap/sap_deployment_automation_framework/deploy_hana_sr.yml +++ b/schedule/sles4sap/sap_deployment_automation_framework/sdaf_deployment.yml @@ -9,4 +9,4 @@ schedule: - sles4sap/sap_deployment_automation_framework/configure_deployer - sles4sap/sap_deployment_automation_framework/deploy_workload_zone - sles4sap/sap_deployment_automation_framework/deploy_sap_systems - - sles4sap/sap_deployment_automation_framework/deploy_hanasr + - sles4sap/sap_deployment_automation_framework/execute_playbooks diff --git a/t/27_sdaf_configure_tfvars.t b/t/27_sdaf_configure_tfvars.t index 186fbe6175a2..7e928ba98ffa 100644 --- a/t/27_sdaf_configure_tfvars.t +++ b/t/27_sdaf_configure_tfvars.t @@ -11,13 +11,13 @@ use sles4sap::sap_deployment_automation_framework::configure_tfvars; sub undef_variables { # undefines OpenQA variables set_var($_, undef) foreach qw( - SDAF_DB_IMAGE_PUBLISHER - SDAF_DB_IMAGE_OFFER - SDAF_DB_IMAGE_SKU - SDAF_DB_IMAGE_VERSION - SDAF_DB_IMAGE_OS_TYPE - SDAF_DB_SOURCE_IMAGE_ID - SDAF_DB_IMAGE_TYPE + SDAF_IMAGE_PUBLISHER + SDAF_IMAGE_OFFER + SDAF_IMAGE_SKU + SDAF_IMAGE_VERSION + SDAF_IMAGE_OS_TYPE + SDAF_SOURCE_IMAGE_ID + SDAF_IMAGE_TYPE ); } @@ -34,9 +34,10 @@ subtest '[prepare_tfvars_file] Test curl commands' => sub { $ms_sdaf->redefine(upload_logs => sub { return 1; }); $ms_sdaf->redefine(replace_tfvars_variables => sub { return 1; }); $ms_sdaf->redefine(get_os_variable => sub { return $_[0]; }); - $ms_sdaf->redefine(set_db_image_parameters => sub { return; }); + $ms_sdaf->redefine(set_image_parameters => sub { return; }); $ms_sdaf->redefine(set_workload_vnet_name => sub { return 'vnet'; }); - + $ms_sdaf->redefine(set_hana_db_parameters => sub { return 'lungo'; }); + $ms_sdaf->redefine(set_netweaver_parameters => sub { return 'americano'; }); $ms_sdaf->redefine(data_url => sub { return 'http://openqa.suse.de/data/' . join('', @_); }); # '-o' is only for checking if correct parameter gets picked from %tfvars_os_variable @@ -53,26 +54,28 @@ subtest '[prepare_tfvars_file] Test curl commands' => sub { } }; -subtest '[set_vm_image_parameters]' => sub { +subtest '[set_image_parameters]' => sub { my $ms_sdaf = Test::MockModule->new('sles4sap::sap_deployment_automation_framework::configure_tfvars', no_auto => 1); $ms_sdaf->redefine(assert_script_run => sub { return 1; }); $ms_sdaf->redefine(upload_logs => sub { return 1; }); $ms_sdaf->redefine(replace_tfvars_variables => sub { return 1; }); $ms_sdaf->redefine(get_os_variable => sub { return 'espresso'; }); $ms_sdaf->redefine(set_workload_vnet_name => sub { return 'latte'; }); + $ms_sdaf->redefine(set_hana_db_parameters => sub { return 'lungo'; }); + $ms_sdaf->redefine(set_netweaver_parameters => sub { return 'americano'; }); $ms_sdaf->redefine(data_url => sub { return 'capuccino'; }); set_var('PUBLIC_CLOUD_IMAGE_ID', 'suse:sles-sap-15-sp6:gen2:latest'); prepare_tfvars_file(deployment_type => 'sap_system'); my %expected_values = ( - SDAF_DB_IMAGE_OS_TYPE => 'LINUX', - SDAF_DB_SOURCE_IMAGE_ID => '', - SDAF_DB_IMAGE_TYPE => 'marketplace', - SDAF_DB_IMAGE_PUBLISHER => 'suse', - SDAF_DB_IMAGE_OFFER => 'sles-sap-15-sp6', - SDAF_DB_IMAGE_SKU => 'gen2', - SDAF_DB_IMAGE_VERSION => 'latest' + SDAF_IMAGE_OS_TYPE => 'LINUX', + SDAF_SOURCE_IMAGE_ID => '', + SDAF_IMAGE_TYPE => 'marketplace', + SDAF_IMAGE_PUBLISHER => 'suse', + SDAF_IMAGE_OFFER => 'sles-sap-15-sp6', + SDAF_IMAGE_SKU => 'gen2', + SDAF_IMAGE_VERSION => 'latest' ); foreach (keys(%expected_values)) { @@ -82,5 +85,46 @@ subtest '[set_vm_image_parameters]' => sub { undef_variables; }; +subtest '[set_hana_db_parameters]' => sub { + my $ms_sdaf = Test::MockModule->new('sles4sap::sap_deployment_automation_framework::configure_tfvars', no_auto => 1); + $ms_sdaf->redefine(assert_script_run => sub { return 1; }); + $ms_sdaf->redefine(upload_logs => sub { return 1; }); + $ms_sdaf->redefine(replace_tfvars_variables => sub { return 1; }); + $ms_sdaf->redefine(get_os_variable => sub { return 'espresso'; }); + $ms_sdaf->redefine(set_workload_vnet_name => sub { return 'latte'; }); + $ms_sdaf->redefine(set_image_parameters => sub { return 'lungo'; }); + $ms_sdaf->redefine(set_netweaver_parameters => sub { return 'americano'; }); + $ms_sdaf->redefine(data_url => sub { return 'capuccino'; }); + set_var('SDAF_DEPLOYMENT_SCENARIO', 'db_ha'); + prepare_tfvars_file(deployment_type => 'sap_system'); + is get_var('SDAF_HANA_HA_SETUP'), 'true', 'Set "SDAF_HANA_HA_SETUP" to true with "db_ha" scenario'; + undef_variables; + + set_var('SDAF_DEPLOYMENT_SCENARIO', 'db_install'); + prepare_tfvars_file(deployment_type => 'sap_system'); + is get_var('SDAF_HANA_HA_SETUP'), 'false', 'Set "SDAF_HANA_HA_SETUP" to false for non HA scenario'; + undef_variables; +}; + +subtest '[set_netweaver_parameters] Scenario "nw_pas,nw_aas,nw_ensa"' => sub { + my $ms_sdaf = Test::MockModule->new('sles4sap::sap_deployment_automation_framework::configure_tfvars', no_auto => 1); + $ms_sdaf->redefine(assert_script_run => sub { return 1; }); + $ms_sdaf->redefine(upload_logs => sub { return 1; }); + $ms_sdaf->redefine(replace_tfvars_variables => sub { return 1; }); + $ms_sdaf->redefine(get_os_variable => sub { return 'espresso'; }); + $ms_sdaf->redefine(set_workload_vnet_name => sub { return 'latte'; }); + $ms_sdaf->redefine(set_image_parameters => sub { return 'lungo'; }); + $ms_sdaf->redefine(data_url => sub { return 'capuccino'; }); + + set_var('SDAF_DEPLOYMENT_SCENARIO', 'nw_pas,nw_aas,nw_ensa'); + prepare_tfvars_file(deployment_type => 'sap_system'); + + is get_var('SDAF_ASCS_SERVER'), '1', 'Set "SDAF_ASCS_SERVER" to "1"'; + is get_var('SDAF_APP_SERVER_COUNT'), '2', 'Set "SDAF_APP_SERVER_COUNT" to "2"'; + is get_var('SDAF_ERS_SERVER'), 'true', 'Set "SDAF_ERS_SERVER" to "true"'; + + undef_variables; +}; + done_testing; diff --git a/tests/sles4sap/sap_deployment_automation_framework/deploy_hanasr.pm b/tests/sles4sap/sap_deployment_automation_framework/execute_playbooks.pm similarity index 52% rename from tests/sles4sap/sap_deployment_automation_framework/deploy_hanasr.pm rename to tests/sles4sap/sap_deployment_automation_framework/execute_playbooks.pm index 1f01ffdff354..7fc0b7459140 100644 --- a/tests/sles4sap/sap_deployment_automation_framework/deploy_hanasr.pm +++ b/tests/sles4sap/sap_deployment_automation_framework/execute_playbooks.pm @@ -7,15 +7,6 @@ # https://learn.microsoft.com/en-us/azure/sap/automation/tutorial#sap-application-installation # Playbooks can be found in SDAF repo: https://github.com/Azure/sap-automation/tree/main/deploy/ansible -# Required OpenQA variables: -# 'SDAF_ENV_CODE' Code for SDAF deployment env. -# 'PUBLIC_CLOUD_REGION' SDAF internal code for azure region. -# 'SAP_SID' SAP system ID. -# 'SDAF_DEPLOYER_RESOURCE_GROUP' Existing deployer resource group - part of the permanent cloud infrastructure. - -# Optional: -# 'SDAF_ANSIBLE_VERBOSITY_LEVEL' Override default verbosity for 'ansible-playbook'. - use parent 'sles4sap::sap_deployment_automation_framework::basetest'; use strict; use warnings; @@ -35,10 +26,78 @@ use sles4sap::console_redirection use serial_terminal qw(select_serial_terminal); use testapi; +=head1 SYNOPSIS + +Executes setup of HanaSR scenario using SDAF ansible playbooks according to: + https://learn.microsoft.com/en-us/azure/sap/automation/tutorial#sap-application-installation +Playbooks can be found in SDAF repo: https://github.com/Azure/sap-automation/tree/main/deploy/ansible + +B + SDAF_ENV_CODE Code for SDAF deployment env. + PUBLIC_CLOUD_REGION SDAF internal code for azure region. + SAP_SID SAP system ID. + SDAF_DEPLOYER_RESOURCE_GROUP Existing deployer resource group - part of the permanent cloud infrastructure. + +Optional: + 'SDAF_ANSIBLE_VERBOSITY_LEVEL' Override default verbosity for 'ansible-playbook'. + +=cut + sub test_flags { return {fatal => 1}; } +sub playbook_settings { + # General playbooks that must be run in all scenarios + my @playbooks = ( + # Fetches SSH key from Workload zone keyvault for accesssing SUTs + {playbook_filename => 'pb_get-sshkey.yaml', timeout => 90}, + # Validate parameters + {playbook_filename => 'playbook_00_validate_parameters.yaml', timeout => 120}, + # Base operating system configuration + {playbook_filename => 'playbook_01_os_base_config.yaml'}); + + my @supported_components = qw(db_install db_ha nw_pas nw_aas nw_ensa); + my @component_list = @{get_var_array('SDAF_DEPLOYMENT_SCENARIO')}; + + # DB installation pulls in SAP specific configuration + if (grep /db_install/, @component_list) { + # SAP-specific operating system configuration + push @playbooks, {playbook_filename => 'playbook_02_os_sap_specific_config.yaml'}; + # SAP Bill of Materials processing - this also mounts install media storage + push @playbooks, {playbook_filename => 'playbook_03_bom_processing.yaml', timeout => 7200}; + # SAP HANA database installation + push @playbooks, {playbook_filename => 'playbook_04_00_00_db_install.yaml', timeout => 1800}; + } + + if (grep /db_ha/, @component_list) { + # SAP HANA high-availability configuration + push @playbooks, {playbook_filename => 'playbook_04_00_01_db_ha.yaml', timeout => 1800}; + } + + # playbooks required for all nw* scenarios + if (grep /nw/, @component_list) { + # SAP ASCS installation, including ENSA if specified in tfvars + push @playbooks, {playbook_filename => 'playbook_05_00_00_sap_scs_install.yaml', timeout => 7200}; + # Execute database import + push @playbooks, {playbook_filename => 'playbook_05_01_sap_dbload.yaml', timeout => 7200}; + # SAP primary application server installation + push @playbooks, {playbook_filename => 'playbook_05_02_sap_pas_install.yaml', timeout => 7200}; + } + + if (grep /nw_aas/, @component_list) { + # SAP additional application server installation + push @playbooks, {playbook_filename => 'playbook_05_03_sap_app_install.yaml', timeout => 3600}; + } + + if (grep /nw_ensa/, @component_list) { + # Configure ENSA cluster + push @playbooks, {playbook_filename => 'playbook_06_00_acss_registration.yaml', timeout => 1800}; + } + + return (@playbooks); +} + sub run { serial_console_diag_banner('Module sdaf_deploy_hanasr.pm : start'); my $sdaf_config_root_dir = get_sdaf_config_path( @@ -51,22 +110,9 @@ sub run { # List of playbooks (and their options) to be executed. Keep them in list to be ordered. Each entry must be an ARRAYREF. # Playbook description is here as well: https://learn.microsoft.com/en-us/azure/sap/automation/run-ansible?tabs=linux - my @execute_playbooks = ( - # Fetches SSH key from Workload zone keyvault for accesssing SUTs - {playbook_filename => 'pb_get-sshkey.yaml', timeout => 90}, - # Validate parameters - {playbook_filename => 'playbook_00_validate_parameters.yaml', timeout => 120}, - # Base operating system configuration - {playbook_filename => 'playbook_01_os_base_config.yaml'}, - # SAP-specific operating system configuration - {playbook_filename => 'playbook_02_os_sap_specific_config.yaml'}, - # SAP Bill of Materials processing - this also mounts install media storage - {playbook_filename => 'playbook_03_bom_processing.yaml'}, - # SAP HANA database installation - {playbook_filename => 'playbook_04_00_00_db_install.yaml', timeout => 1800}, - # SAP HANA high-availability configuration - {playbook_filename => 'playbook_04_00_01_db_ha.yaml', timeout => 1800}, - ); + my @execute_playbooks = playbook_settings(); + my @playbook_list = map { $_->{playbook_filename} } @execute_playbooks; + record_info('Playbook list', "Following playbooks will be executed:\n" . join("\n", @playbook_list)); connect_target_to_serial(); load_os_env_variables();