diff --git a/README.md b/README.md index 348bb53..740e355 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,18 @@ SAP Software Provisioning Manager used for this solution is **2.0 SP13** and it' The VSIs are configured with Red Hat Enterprise Linux 8 for SAP HANA (amd64) and they have: at least two SSH keys configured to access as root user and the following storage volumes created for DB and SAP APP VSI: HANA DB VSI Disks: -- 3 x 500 GB disks with 10 IOPS / GB - DATA -- 1 x 10 GB disk - SWAP +- the disk sizes depend on the selected profile, according to [Intel Virtual Server certified profiles on VPC infrastructure for SAP HANA](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc) - Last updated 2022-01-28 + +Note: LVM will be used for **`/hana/data`**, **`hana/log`**, **`/hana/shared`** and **`/usr/sap`**, for all storage profiles, excepting **`vx2d-44x616`** and **`vx2d-88x1232`** profiles, where **`/hana/data`** and **`/hana/shared`** won't be manged by LVM, according to [Intel Virtual Server certified profiles on VPC infrastructure for SAP HANA](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc#vx2d-16x224) - Last updated 2022-01-28 and to [Storage design considerations](https://cloud.ibm.com/docs/sap?topic=sap-storage-design-considerations#hana-iaas-mx2-16x128-32x256-configure) - Last updated 2022-05-19 + +For example, in case of deploying a HANA VM, using the default value for VSI profile `mx2-16x128`, the automation will execute the following storage setup: +- 3 volumes x 500 GB each for `_hana_vg` volume group + - the volume group will contain the following logical volumes (created with three stripes): + - `_hana_data_lv` - size 988 GB + - `_hana_log_lv` - size 256 GB + - `_hana_shared` - size 256 GB +- 1 volume x 50 GB for `/usr/sap` (volume group: `_usr_sap_vg`, logical volume: `_usr_sap_lv`) +- 1 volume x 10 GB for a 2 GB SWAP logical volume (volume group: `_swap_vg`, logical volume: `_swap_lv`) SAP APPs VSI Disks: - 1x 40 GB disk with 10 IOPS / GB - SWAP @@ -67,15 +77,15 @@ DOMAIN_NAME = "example.com" # You can't use a domain name that is already in use. # Domain names are not case sensitive. -ASCS-VIRT-HOSTNAME = "sapascs" +ASCS_VIRT_HOSTNAME = "sapascs" # ASCS Virtual hostname​ # Default = "sap($your_sap_sid)ascs" -ERS-VIRT-HOSTNAME = "sapers" +ERS_VIRT_HOSTNAME = "sapers" # ERS Virtual Hostname​ # Default = "sap($your_sap_sid)ascs" -HANA-VIRT-HOSTNAME = "dbhana" +HANA_VIRT_HOSTNAME = "dbhana" # Hana Virtual Hostname # Default = "db($your_hana_sid)hana" @@ -104,171 +114,171 @@ SSH_KEYS = [ "r010-57bfc315-f9e5-46bf-bf61-d87a24a9ce7a", "r010-3fcd9fe7-d4a7-41 # File Shares variables: ########################################################## -share_profile = "tier-5iops" +SHARE_PROFILE = "tier-5iops" # Enter the IOPs (IOPS per GB) tier for File Share storage. Valid values are 3, 5, and 10. # File shares sizes: -usrsap-as1 = "20" -usrsap-as2 = "20" -usrsap-sapascs = "20" -usrsap-sapers = "20" -usrsap-sapmnt = "20" -usrsap-sapsys = "20" -usrsap-trans = "80" +USRSAP_AS1 = "20" +USRSAP_AS2 = "20" +USRSAP_SAPASCS = "20" +USRSAP_SAPERS = "20" +USRSAP_SAPMNT = "20" +USRSAP_SAPSYS = "20" +USRSAP_TRANS = "80" # Enter Custom File Shares sizes for SAP mounts. ########################################################## # DB VSI variables: ########################################################## -DB-HOSTNAME-1 = "hanadb-1" +DB_HOSTNAME_1 = "hanadb-1" # Hana Cluster VSI1 Hostname. # The Hostname for the DB VSI. The hostname should be up to 13 characters, as required by SAP -# Default: DB-HOSTNAME-1 = "hanadb-$your_hana_sid-1" +# Default: DB_HOSTNAME_1 = "hanadb-$your_hana_sid-1" -DB-HOSTNAME-2 = "hanadb-2" +DB_HOSTNAME_2 = "hanadb-2" # Hana Cluster VSI2 Hostname. # The Hostname for the DB VSI. The hostname should be up to 13 characters, as required by SAP -# Default: DB-HOSTNAME-2 = "hanadb-$your_hana_sid-2" +# Default: DB_HOSTNAME_2 = "hanadb-$your_hana_sid-2" -DB-PROFILE = "mx2-16x128" +DB_PROFILE = "mx2-16x128" # The DB VSI profile. Supported profiles for DB VSI: mx2-16x128. The list of available profiles: https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui -DB-IMAGE = "ibm-redhat-8-6-amd64-sap-hana-2" +DB_IMAGE = "ibm-redhat-8-6-amd64-sap-hana-2" # OS image for DB VSI. Supported OS images for DB VSIs: ibm-redhat-8-4-amd64-sap-hana-4 # The list of available VPC Operating Systems supported by SAP: SAP note '2927211 - SAP Applications on IBM Virtual Private Cloud (VPC) Infrastructure environment' https://launchpad.support.sap.com/#/notes/2927211; The list of all available OS images: https://cloud.ibm.com/docs/vpc?topic=vpc-about-images -# Example: DB-IMAGE = "ibm-redhat-8-4-amd64-sap-hana-4" +# Example: DB_IMAGE = "ibm-redhat-8-4-amd64-sap-hana-4" ########################################################## # SAP APP VSI variables: ########################################################## -APP-HOSTNAME-1 = "sapapp-1" +APP_HOSTNAME_1 = "sapapp-1" # SAP Cluster VSI1 Hostname. # The Hostname for the SAP APP VSI. The hostname should be up to 13 characters, as required by SAP -# Default: APP-HOSTNAME-1 = "sapapp-$your_sap_sid-1" +# Default: APP_HOSTNAME_1 = "sapapp-$your_sap_sid-1" -APP-HOSTNAME-2 = "sapapp-2" +APP_HOSTNAME_2 = "sapapp-2" # SAP Cluster VSI2 Hostname. # The Hostname for the SAP APP VSI. The hostname should be up to 13 characters, as required by SAP -# Default: APP-HOSTNAME-2 = "sapapp-$your_sap_sid-2" +# Default: APP_HOSTNAME_2 = "sapapp-$your_sap_sid-2" -APP-PROFILE = "bx2-4x16" +APP_PROFILE = "bx2-4x16" # The APP VSI profile. Supported profiles: bx2-4x16. The list of available profiles: https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui -APP-IMAGE = "ibm-redhat-8-6-amd64-sap-hana-2" +APP_IMAGE = "ibm-redhat-8-6-amd64-sap-hana-2" # OS image for SAP APP VSI. Supported OS images for APP VSIs: ibm-redhat-8-4-amd64-sap-hana-4. # The list of available VPC Operating Systems supported by SAP: SAP note '2927211 - SAP Applications on IBM Virtual Private Cloud (VPC) Infrastructure environment' https://launchpad.support.sap.com/#/notes/2927211; The list of all available OS images: https://cloud.ibm.com/docs/vpc?topic=vpc-about-images -# Example: APP-IMAGE = "ibm-redhat-8-4-amd64-sap-hana-4" +# Example: APP_IMAGE = "ibm-redhat-8-4-amd64-sap-hana-4" ...... ``` Parameter | Description ----------|------------ -ibmcloud_api_key | IBM Cloud API key (Sensitive* value). +IBMCLOUD_API_KEY | IBM Cloud API key (Sensitive* value). SSH_KEYS | List of SSH Keys IDs that are allowed to SSH as root to the VSI. Can contain one or more IDs. The list of SSH Keys is available [here](https://cloud.ibm.com/vpc-ext/compute/sshKeys).
Sample input (use your own SSH IDS from IBM Cloud):
[ "r010-57bfc315-f9e5-46bf-bf61-d87a24a9ce7a" , "r010-3fcd9fe7-d4a7-41ce-8bb3-d96e936b2c7e" ] REGION | The cloud region where to deploy the solution.
The regions and zones for VPC are listed [here](https://cloud.ibm.com/docs/containers?topic=containers-regions-and-zones#zones-vpc).
Sample value: eu-de. ZONE | The cloud zone where to deploy the solution.
Sample value: eu-de-2. DOMAIN_NAME | The Domain Name used for DNS and ALB. Duplicates are not allowed. The list with DNS resources can be searched [here](https://cloud.ibm.com/resources).
Sample value: "example.com" -SHARE PROFILES | IOPS per GB tier for File Share storage. Valid values are 3, 5, and 10. For more info about file share profiles, check [here](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles).
Default value: share_profile = "tier-5iops". -SHARE SIZES | Custom File Shares Sizes for SAP mounts. Sample values: usrsap-sapmnt = "20" , usrsap-trans = "80". +SHARE PROFILES | IOPS per GB tier for File Share storage. Valid values are 3, 5, and 10. For more info about file share profiles, check [here](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles).
Default value: SHARE_PROFILE = "tier-5iops". +SHARE SIZES | Custom File Shares Sizes for SAP mounts. Sample values: USRSAP_SAPMNT = "20" , USRSAP_TRANS = "80". [DB/APP]-
VIRT-HOSTNAMES | ASCS/ERS/HANA virtual hostnames.
Default values: "sap($your_sap_sid)ascs/ers" , "sap($your_sap_sid)ers" , "db($your_hana_sid)hana". VPC | The name of an EXISTING VPC. The list of VPCs is available [here](https://cloud.ibm.com/vpc-ext/network/vpcs) SUBNET | The name of an EXISTING Subnet. The list of Subnets is available [here](https://cloud.ibm.com/vpc-ext/network/subnets). SECURITY_GROUP | The name of an EXISTING Security group. The list of Security Groups is available [here](https://cloud.ibm.com/vpc-ext/network/securityGroups). RESOURCE_GROUP | The name of an EXISTING Resource Group for VSIs and Volumes resources. The list of Resource Groups is available [here](https://cloud.ibm.com/account/resource-groups). -[DB/APP]-HOSTNAMES | SAP HANA/APP Cluster VSI Hostnames. Each hostname should be up to 13 characters as required by SAP.
For more information on rules regarding hostnames for SAP systems, check [SAP Note 611361: Hostnames of SAP ABAP Platform servers](https://launchpad.support.sap.com/#/notes/%20611361).
Default values: APP-HOSTNAME-1/2 = "sapapp-$your_sap_sid-1/2" , DB-HOSTNAME-1/2 = "hanadb-$your_hana_sid-1/2". +[DB/APP]-HOSTNAMES | SAP HANA/APP Cluster VSI Hostnames. Each hostname should be up to 13 characters as required by SAP.
For more information on rules regarding hostnames for SAP systems, check [SAP Note 611361: Hostnames of SAP ABAP Platform servers](https://launchpad.support.sap.com/#/notes/%20611361).
Default values: APP_HOSTNAME_1/2 = "sapapp-$your_sap_sid-1/2" , DB_HOSTNAME_1/2 = "hanadb-$your_hana_sid-1/2". [DB/APP]-PROFILES | The profile used for the HANA/APP VSI. A list of profiles is available [here](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles).
For more information about supported DB/OS and IBM Gen 2 Virtual Server Instances (VSI), check [SAP Note 2927211: SAP Applications on IBM Virtual Private Cloud](https://launchpad.support.sap.com/#/notes/2927211) [DB/APP]-IMAGE | The OS image used for the HANA/APP VSI. You must use the Red Hat Enterprise Linux 8 for SAP HANA (amd64) image for all VMs as this image contains the required SAP and HA subscriptions. A list of images is available [here](https://cloud.ibm.com/docs/vpc?topic=vpc-about-images) Edit your SAP system configuration variables that will be passed to the ansible automated deployment: ```shell -hana_sid = "HDB" +HANA_SID = "HDB" # SAP HANA system ID. Should follow the SAP rules for SID naming. # Obs. This will be used also as identification number across different HA name resources. Duplicates are not allowed. -# Example: hana_sid = "HDB" +# Example: HANA_SID = "HDB" -hana_sysno = "00" +HANA_SYSNO = "00" # SAP HANA instance number. Should follow the SAP rules for instance number naming. -# Example: hana_sysno = "00" +# Example: HANA_SYSNO = "00" -hana_system_usage = "custom" +HANA_SYSTEM_USAGE = "custom" # System usage. Default: custom. Suported values: production, test, development, custom -# Example: hana_system_usage = "custom" +# Example: HANA_SYSTEM_USAGE = "custom" -hana_components = "server" +HANA_COMPONENTS = "server" # SAP HANA Components. Default: server. Supported values: all, client, es, ets, lcapps, server, smartda, streaming, rdsync, xs, studio, afl, sca, sop, eml, rme, rtl, trp -# Example: hana_components = "server" +# Example: HANA_COMPONENTS = "server" -kit_saphana_file = "/storage/HANADB/51055299.ZIP" +KIT_SAPHANA_FILE = "/storage/HANADB/51055299.ZIP" # SAP HANA Installation kit path # Supported SAP HANA versions on Red Hat 8.4, 8.6 and Suse 15.3, 15.4: HANA 2.0 SP 5 Rev 57, kit file: 51055299.ZIP -# Example for Red Hat 8 or Suse 15: kit_saphana_file = "/storage/HANADB/51055299.ZIP" +# Example for Red Hat 8 or Suse 15: KIT_SAPHANA_FILE = "/storage/HANADB/51055299.ZIP" ########################################################## # SAP system configuration ########################################################## -sap_sid = "NWD" +SAP_SID = "NWD" # SAP System ID # Obs. This will be used also as identification number across different HA name resources. Duplicates are not allowed. -sap_ascs_instance_number = "00" +SAP_ASCS_INSTANCE_NUMBER = "00" # The central ABAP service instance number. Should follow the SAP rules for instance number naming. -# Example: sap_ascs_instance_number = "00" +# Example: SAP_ASCS_INSTANCE_NUMBER = "00" -sap_ers_instance_number = "01" +SAP_ERS_INSTANCE_NUMBER = "01" # The enqueue replication server instance number. Should follow the SAP rules for instance number naming. -# Example: sap_ers_instance_number = "01" +# Example: SAP_ERS_INSTANCE_NUMBER = "01" -sap_ci_instance_number = "10" +SAP_CI_INSTANCE_NUMBER = "10" # The primary application server instance number. Should follow the SAP rules for instance number naming. -# Example: sap_ci_instance_number = "10" +# Example: SAP_CI_INSTANCE_NUMBER = "10" -sap_aas_instance_number = "20" +SAP_AAS_INSTANCE_NUMBER = "20" # The additional application server instance number. Should follow the SAP rules for instance number naming. -# Example: sap_aas_instance_number = "20" +# Example: SAP_AAS_INSTANCE_NUMBER = "20" -hdb_concurrent_jobs = "23" +HDB_CONCURRENT_JOBS = "23" # Number of concurrent jobs used to load and/or extract archives to HANA Host ########################################################## # SAP S/4HANA APP Kit Paths ########################################################## -kit_sapcar_file = "/storage/S4HANA/SAPCAR_1010-70006178.EXE" -kit_swpm_file = "/storage/S4HANA/SWPM20SP13_1-80003424.SAR" -kit_sapexe_file = "/storage/S4HANA/SAPEXE_100-70005283.SAR" -kit_sapexedb_file = "/storage/S4HANA/SAPEXEDB_100-70005282.SAR" -kit_igsexe_file = "/storage/S4HANA/igsexe_1-70005417.sar" -kit_igshelper_file = "/storage/S4HANA/igshelper_17-10010245.sar" -kit_saphotagent_file = "/storage/S4HANA/SAPHOSTAGENT51_51-20009394.SAR" -kit_hdbclient_file = "/storage/S4HANA/IMDB_CLIENT20_009_28-80002082.SAR" -kit_s4hana_export = "/storage/S4HANA/export" +KIT_SAPCAR_FILE = "/storage/S4HANA/SAPCAR_1010-70006178.EXE" +KIT_SWPM_FILE = "/storage/S4HANA/SWPM20SP13_1-80003424.SAR" +KIT_SAPEXE_FILE = "/storage/S4HANA/SAPEXE_100-70005283.SAR" +KIT_SAPEXEDB_FILE = "/storage/S4HANA/SAPEXEDB_100-70005282.SAR" +KIT_IGSEXE_FILE = "/storage/S4HANA/igsexe_1-70005417.sar" +KIT_IGSHELPER_FILE = "/storage/S4HANA/igshelper_17-10010245.sar" +KIT_SAPHOSTAGENT_FILE = "/storage/S4HANA/SAPHOSTAGENT51_51-20009394.SAR" +KIT_HDBCLIENT_FILE = "/storage/S4HANA/IMDB_CLIENT20_009_28-80002082.SAR" +KIT_S4HANA_EXPORT = "/storage/S4HANA/export" ``` **SAP input parameters:** Parameter | Description | Requirements ----------|-------------|------------- -hana_sid | The SAP system ID identifies the SAP HANA system |
  • Consists of exactly three alphanumeric characters
  • Has a letter for the first character
  • Does not include any of the reserved IDs listed in SAP Note 1979280
| -hana_sysno | Specifies the instance number of the SAP HANA system|
  • Two-digit number from 00 to 97
  • Must be unique on a host
-hana_system_usage | System Usage | Default: custom
Valid values: production, test, development, custom -hana_components | SAP HANA Components | Default: server
Valid values: all, client, es, ets, lcapps, server, smartda, streaming, rdsync, xs, studio, afl, sca, sop, eml, rme, rtl, trp -kit_saphana_file | Path to SAP HANA ZIP file | As downloaded from SAP Support Portal -sap_sid | The SAP system ID identifies the entire SAP system |
  • Consists of exactly three alphanumeric characters
  • Has a letter for the first character
  • Does not include any of the reserved IDs listed in SAP Note 1979280
-sap_ascs_instance_number | Technical identifier for internal processes of ASCS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
-sap_ers_instance_number | Technical identifier for internal processes of ERS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
-sap_ci_instance_number | Technical identifier for internal processes of PAS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
-sap_aas_instance_number | Technical identifier for internal processes of AAS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
-hdb_concurrent_jobs | Number of concurrent jobs used to load and/or extract archives to HANA Host | Default: 23 -kit_sapcar_file | Path to sapcar binary | As downloaded from SAP Support Portal -kit_swpm_file | Path to SWPM archive (SAR) | As downloaded from SAP Support Portal -kit_sapexe_file | Path to SAP Kernel OS archive (SAR) | As downloaded from SAP Support Portal -kit_sapexedb_file | Path to SAP Kernel DB archive (SAR) | As downloaded from SAP Support Portal -kit_igsexe_file | Path to IGS archive (SAR) | As downloaded from SAP Support Portal -kit_igshelper_file | Path to IGS Helper archive (SAR) | As downloaded from SAP Support Portal +HANA_SID | The SAP system ID identifies the SAP HANA system |
  • Consists of exactly three alphanumeric characters
  • Has a letter for the first character
  • Does not include any of the reserved IDs listed in SAP Note 1979280
| +HANA_SYSNO | Specifies the instance number of the SAP HANA system|
  • Two-digit number from 00 to 97
  • Must be unique on a host
+HANA_SYSTEM_USAGE | System Usage | Default: custom
Valid values: production, test, development, custom +HANA_COMPONENTS | SAP HANA Components | Default: server
Valid values: all, client, es, ets, lcapps, server, smartda, streaming, rdsync, xs, studio, afl, sca, sop, eml, rme, rtl, trp +KIT_SAPHANA_FILE | Path to SAP HANA ZIP file | As downloaded from SAP Support Portal +SAP_SID | The SAP system ID identifies the entire SAP system |
  • Consists of exactly three alphanumeric characters
  • Has a letter for the first character
  • Does not include any of the reserved IDs listed in SAP Note 1979280
+SAP_ASCS_INSTANCE_NUMBER | Technical identifier for internal processes of ASCS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
+SAP_ERS_INSTANCE_NUMBER | Technical identifier for internal processes of ERS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
+SAP_CI_INSTANCE_NUMBER | Technical identifier for internal processes of PAS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
+SAP_AAS_INSTANCE_NUMBER | Technical identifier for internal processes of AAS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
+HDB_CONCURRENT_JOBS | Number of concurrent jobs used to load and/or extract archives to HANA Host | Default: 23 +KIT_SAPCAR_FILE | Path to sapcar binary | As downloaded from SAP Support Portal +KIT_SWPM_FILE | Path to SWPM archive (SAR) | As downloaded from SAP Support Portal +KIT_SAPEXE_FILE | Path to SAP Kernel OS archive (SAR) | As downloaded from SAP Support Portal +KIT_SAPEXEDB_FILE | Path to SAP Kernel DB archive (SAR) | As downloaded from SAP Support Portal +KIT_IGSEXE_FILE | Path to IGS archive (SAR) | As downloaded from SAP Support Portal +KIT_IGSHELPER_FILE | Path to IGS Helper archive (SAR) | As downloaded from SAP Support Portal kit_saphostagent_file | Path to SAP Host Agent archive (SAR) | As downloaded from SAP Support Portal -kit_hdbclient_file | Path to HANA DB client archive (SAR) | As downloaded from SAP Support Portal -kit_s4hana_export | Path to S/4HANA Installation Export dir | The archives downloaded from SAP Support Portal should be present in this path +KIT_HDBCLIENT_FILE | Path to HANA DB client archive (SAR) | As downloaded from SAP Support Portal +KIT_S4HANA_EXPORT | Path to S/4HANA Installation Export dir | The archives downloaded from SAP Support Portal should be present in this path **SAP Passwords** @@ -276,9 +286,9 @@ The passwords for the SAP system will be asked interactively during terraform pl Parameter | Description | Requirements ----------|-------------|------------- -sap_main_password | Common password for all users that are created during the installation |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
-hana_main_password | HANA system master password |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
  • Master Password must contain at least one upper-case character
-ha_password | HA cluster password |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
+SAP_MAIN_PASSWORD | Common password for all users that are created during the installation |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
+HANA_MAIN_PASSWORD | HANA system master password |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
  • Master Password must contain at least one upper-case character
+HA_PASSWORD | HA cluster password |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
**Obs***:
- Sensitive - The variable value is not displayed in your tf files details after terrafrorm plan&apply commands.
@@ -314,7 +324,7 @@ For planning phase: ```shell terraform plan --out plan1 -# you will be asked for the following sensitive variables: 'ibmcloud_api_key', 'sap_main_password' , 'hana_main_password' and 'ha_password'. +# you will be asked for the following sensitive variables: 'IBMCLOUD_API_KEY', 'SAP_MAIN_PASSWORD' , 'HANA_MAIN_PASSWORD' and 'HA_PASSWORD'. ``` For apply phase: @@ -328,7 +338,7 @@ For destroy: ```shell terraform destroy # you will be asked for the following sensitive variables as a destroy confirmation phase: -'ibmcloud_api_key', 'sap_main_password' , 'hana_main_password' and 'ha_password'. +'IBMCLOUD_API_KEY', 'SAP_MAIN_PASSWORD' , 'HANA_MAIN_PASSWORD' and 'HA_PASSWORD'. ``` ### Related links: diff --git a/cli/README.md b/cli/README.md index 348bb53..740e355 100644 --- a/cli/README.md +++ b/cli/README.md @@ -33,8 +33,18 @@ SAP Software Provisioning Manager used for this solution is **2.0 SP13** and it' The VSIs are configured with Red Hat Enterprise Linux 8 for SAP HANA (amd64) and they have: at least two SSH keys configured to access as root user and the following storage volumes created for DB and SAP APP VSI: HANA DB VSI Disks: -- 3 x 500 GB disks with 10 IOPS / GB - DATA -- 1 x 10 GB disk - SWAP +- the disk sizes depend on the selected profile, according to [Intel Virtual Server certified profiles on VPC infrastructure for SAP HANA](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc) - Last updated 2022-01-28 + +Note: LVM will be used for **`/hana/data`**, **`hana/log`**, **`/hana/shared`** and **`/usr/sap`**, for all storage profiles, excepting **`vx2d-44x616`** and **`vx2d-88x1232`** profiles, where **`/hana/data`** and **`/hana/shared`** won't be manged by LVM, according to [Intel Virtual Server certified profiles on VPC infrastructure for SAP HANA](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc#vx2d-16x224) - Last updated 2022-01-28 and to [Storage design considerations](https://cloud.ibm.com/docs/sap?topic=sap-storage-design-considerations#hana-iaas-mx2-16x128-32x256-configure) - Last updated 2022-05-19 + +For example, in case of deploying a HANA VM, using the default value for VSI profile `mx2-16x128`, the automation will execute the following storage setup: +- 3 volumes x 500 GB each for `_hana_vg` volume group + - the volume group will contain the following logical volumes (created with three stripes): + - `_hana_data_lv` - size 988 GB + - `_hana_log_lv` - size 256 GB + - `_hana_shared` - size 256 GB +- 1 volume x 50 GB for `/usr/sap` (volume group: `_usr_sap_vg`, logical volume: `_usr_sap_lv`) +- 1 volume x 10 GB for a 2 GB SWAP logical volume (volume group: `_swap_vg`, logical volume: `_swap_lv`) SAP APPs VSI Disks: - 1x 40 GB disk with 10 IOPS / GB - SWAP @@ -67,15 +77,15 @@ DOMAIN_NAME = "example.com" # You can't use a domain name that is already in use. # Domain names are not case sensitive. -ASCS-VIRT-HOSTNAME = "sapascs" +ASCS_VIRT_HOSTNAME = "sapascs" # ASCS Virtual hostname​ # Default = "sap($your_sap_sid)ascs" -ERS-VIRT-HOSTNAME = "sapers" +ERS_VIRT_HOSTNAME = "sapers" # ERS Virtual Hostname​ # Default = "sap($your_sap_sid)ascs" -HANA-VIRT-HOSTNAME = "dbhana" +HANA_VIRT_HOSTNAME = "dbhana" # Hana Virtual Hostname # Default = "db($your_hana_sid)hana" @@ -104,171 +114,171 @@ SSH_KEYS = [ "r010-57bfc315-f9e5-46bf-bf61-d87a24a9ce7a", "r010-3fcd9fe7-d4a7-41 # File Shares variables: ########################################################## -share_profile = "tier-5iops" +SHARE_PROFILE = "tier-5iops" # Enter the IOPs (IOPS per GB) tier for File Share storage. Valid values are 3, 5, and 10. # File shares sizes: -usrsap-as1 = "20" -usrsap-as2 = "20" -usrsap-sapascs = "20" -usrsap-sapers = "20" -usrsap-sapmnt = "20" -usrsap-sapsys = "20" -usrsap-trans = "80" +USRSAP_AS1 = "20" +USRSAP_AS2 = "20" +USRSAP_SAPASCS = "20" +USRSAP_SAPERS = "20" +USRSAP_SAPMNT = "20" +USRSAP_SAPSYS = "20" +USRSAP_TRANS = "80" # Enter Custom File Shares sizes for SAP mounts. ########################################################## # DB VSI variables: ########################################################## -DB-HOSTNAME-1 = "hanadb-1" +DB_HOSTNAME_1 = "hanadb-1" # Hana Cluster VSI1 Hostname. # The Hostname for the DB VSI. The hostname should be up to 13 characters, as required by SAP -# Default: DB-HOSTNAME-1 = "hanadb-$your_hana_sid-1" +# Default: DB_HOSTNAME_1 = "hanadb-$your_hana_sid-1" -DB-HOSTNAME-2 = "hanadb-2" +DB_HOSTNAME_2 = "hanadb-2" # Hana Cluster VSI2 Hostname. # The Hostname for the DB VSI. The hostname should be up to 13 characters, as required by SAP -# Default: DB-HOSTNAME-2 = "hanadb-$your_hana_sid-2" +# Default: DB_HOSTNAME_2 = "hanadb-$your_hana_sid-2" -DB-PROFILE = "mx2-16x128" +DB_PROFILE = "mx2-16x128" # The DB VSI profile. Supported profiles for DB VSI: mx2-16x128. The list of available profiles: https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui -DB-IMAGE = "ibm-redhat-8-6-amd64-sap-hana-2" +DB_IMAGE = "ibm-redhat-8-6-amd64-sap-hana-2" # OS image for DB VSI. Supported OS images for DB VSIs: ibm-redhat-8-4-amd64-sap-hana-4 # The list of available VPC Operating Systems supported by SAP: SAP note '2927211 - SAP Applications on IBM Virtual Private Cloud (VPC) Infrastructure environment' https://launchpad.support.sap.com/#/notes/2927211; The list of all available OS images: https://cloud.ibm.com/docs/vpc?topic=vpc-about-images -# Example: DB-IMAGE = "ibm-redhat-8-4-amd64-sap-hana-4" +# Example: DB_IMAGE = "ibm-redhat-8-4-amd64-sap-hana-4" ########################################################## # SAP APP VSI variables: ########################################################## -APP-HOSTNAME-1 = "sapapp-1" +APP_HOSTNAME_1 = "sapapp-1" # SAP Cluster VSI1 Hostname. # The Hostname for the SAP APP VSI. The hostname should be up to 13 characters, as required by SAP -# Default: APP-HOSTNAME-1 = "sapapp-$your_sap_sid-1" +# Default: APP_HOSTNAME_1 = "sapapp-$your_sap_sid-1" -APP-HOSTNAME-2 = "sapapp-2" +APP_HOSTNAME_2 = "sapapp-2" # SAP Cluster VSI2 Hostname. # The Hostname for the SAP APP VSI. The hostname should be up to 13 characters, as required by SAP -# Default: APP-HOSTNAME-2 = "sapapp-$your_sap_sid-2" +# Default: APP_HOSTNAME_2 = "sapapp-$your_sap_sid-2" -APP-PROFILE = "bx2-4x16" +APP_PROFILE = "bx2-4x16" # The APP VSI profile. Supported profiles: bx2-4x16. The list of available profiles: https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui -APP-IMAGE = "ibm-redhat-8-6-amd64-sap-hana-2" +APP_IMAGE = "ibm-redhat-8-6-amd64-sap-hana-2" # OS image for SAP APP VSI. Supported OS images for APP VSIs: ibm-redhat-8-4-amd64-sap-hana-4. # The list of available VPC Operating Systems supported by SAP: SAP note '2927211 - SAP Applications on IBM Virtual Private Cloud (VPC) Infrastructure environment' https://launchpad.support.sap.com/#/notes/2927211; The list of all available OS images: https://cloud.ibm.com/docs/vpc?topic=vpc-about-images -# Example: APP-IMAGE = "ibm-redhat-8-4-amd64-sap-hana-4" +# Example: APP_IMAGE = "ibm-redhat-8-4-amd64-sap-hana-4" ...... ``` Parameter | Description ----------|------------ -ibmcloud_api_key | IBM Cloud API key (Sensitive* value). +IBMCLOUD_API_KEY | IBM Cloud API key (Sensitive* value). SSH_KEYS | List of SSH Keys IDs that are allowed to SSH as root to the VSI. Can contain one or more IDs. The list of SSH Keys is available [here](https://cloud.ibm.com/vpc-ext/compute/sshKeys).
Sample input (use your own SSH IDS from IBM Cloud):
[ "r010-57bfc315-f9e5-46bf-bf61-d87a24a9ce7a" , "r010-3fcd9fe7-d4a7-41ce-8bb3-d96e936b2c7e" ] REGION | The cloud region where to deploy the solution.
The regions and zones for VPC are listed [here](https://cloud.ibm.com/docs/containers?topic=containers-regions-and-zones#zones-vpc).
Sample value: eu-de. ZONE | The cloud zone where to deploy the solution.
Sample value: eu-de-2. DOMAIN_NAME | The Domain Name used for DNS and ALB. Duplicates are not allowed. The list with DNS resources can be searched [here](https://cloud.ibm.com/resources).
Sample value: "example.com" -SHARE PROFILES | IOPS per GB tier for File Share storage. Valid values are 3, 5, and 10. For more info about file share profiles, check [here](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles).
Default value: share_profile = "tier-5iops". -SHARE SIZES | Custom File Shares Sizes for SAP mounts. Sample values: usrsap-sapmnt = "20" , usrsap-trans = "80". +SHARE PROFILES | IOPS per GB tier for File Share storage. Valid values are 3, 5, and 10. For more info about file share profiles, check [here](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles).
Default value: SHARE_PROFILE = "tier-5iops". +SHARE SIZES | Custom File Shares Sizes for SAP mounts. Sample values: USRSAP_SAPMNT = "20" , USRSAP_TRANS = "80". [DB/APP]-
VIRT-HOSTNAMES | ASCS/ERS/HANA virtual hostnames.
Default values: "sap($your_sap_sid)ascs/ers" , "sap($your_sap_sid)ers" , "db($your_hana_sid)hana". VPC | The name of an EXISTING VPC. The list of VPCs is available [here](https://cloud.ibm.com/vpc-ext/network/vpcs) SUBNET | The name of an EXISTING Subnet. The list of Subnets is available [here](https://cloud.ibm.com/vpc-ext/network/subnets). SECURITY_GROUP | The name of an EXISTING Security group. The list of Security Groups is available [here](https://cloud.ibm.com/vpc-ext/network/securityGroups). RESOURCE_GROUP | The name of an EXISTING Resource Group for VSIs and Volumes resources. The list of Resource Groups is available [here](https://cloud.ibm.com/account/resource-groups). -[DB/APP]-HOSTNAMES | SAP HANA/APP Cluster VSI Hostnames. Each hostname should be up to 13 characters as required by SAP.
For more information on rules regarding hostnames for SAP systems, check [SAP Note 611361: Hostnames of SAP ABAP Platform servers](https://launchpad.support.sap.com/#/notes/%20611361).
Default values: APP-HOSTNAME-1/2 = "sapapp-$your_sap_sid-1/2" , DB-HOSTNAME-1/2 = "hanadb-$your_hana_sid-1/2". +[DB/APP]-HOSTNAMES | SAP HANA/APP Cluster VSI Hostnames. Each hostname should be up to 13 characters as required by SAP.
For more information on rules regarding hostnames for SAP systems, check [SAP Note 611361: Hostnames of SAP ABAP Platform servers](https://launchpad.support.sap.com/#/notes/%20611361).
Default values: APP_HOSTNAME_1/2 = "sapapp-$your_sap_sid-1/2" , DB_HOSTNAME_1/2 = "hanadb-$your_hana_sid-1/2". [DB/APP]-PROFILES | The profile used for the HANA/APP VSI. A list of profiles is available [here](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles).
For more information about supported DB/OS and IBM Gen 2 Virtual Server Instances (VSI), check [SAP Note 2927211: SAP Applications on IBM Virtual Private Cloud](https://launchpad.support.sap.com/#/notes/2927211) [DB/APP]-IMAGE | The OS image used for the HANA/APP VSI. You must use the Red Hat Enterprise Linux 8 for SAP HANA (amd64) image for all VMs as this image contains the required SAP and HA subscriptions. A list of images is available [here](https://cloud.ibm.com/docs/vpc?topic=vpc-about-images) Edit your SAP system configuration variables that will be passed to the ansible automated deployment: ```shell -hana_sid = "HDB" +HANA_SID = "HDB" # SAP HANA system ID. Should follow the SAP rules for SID naming. # Obs. This will be used also as identification number across different HA name resources. Duplicates are not allowed. -# Example: hana_sid = "HDB" +# Example: HANA_SID = "HDB" -hana_sysno = "00" +HANA_SYSNO = "00" # SAP HANA instance number. Should follow the SAP rules for instance number naming. -# Example: hana_sysno = "00" +# Example: HANA_SYSNO = "00" -hana_system_usage = "custom" +HANA_SYSTEM_USAGE = "custom" # System usage. Default: custom. Suported values: production, test, development, custom -# Example: hana_system_usage = "custom" +# Example: HANA_SYSTEM_USAGE = "custom" -hana_components = "server" +HANA_COMPONENTS = "server" # SAP HANA Components. Default: server. Supported values: all, client, es, ets, lcapps, server, smartda, streaming, rdsync, xs, studio, afl, sca, sop, eml, rme, rtl, trp -# Example: hana_components = "server" +# Example: HANA_COMPONENTS = "server" -kit_saphana_file = "/storage/HANADB/51055299.ZIP" +KIT_SAPHANA_FILE = "/storage/HANADB/51055299.ZIP" # SAP HANA Installation kit path # Supported SAP HANA versions on Red Hat 8.4, 8.6 and Suse 15.3, 15.4: HANA 2.0 SP 5 Rev 57, kit file: 51055299.ZIP -# Example for Red Hat 8 or Suse 15: kit_saphana_file = "/storage/HANADB/51055299.ZIP" +# Example for Red Hat 8 or Suse 15: KIT_SAPHANA_FILE = "/storage/HANADB/51055299.ZIP" ########################################################## # SAP system configuration ########################################################## -sap_sid = "NWD" +SAP_SID = "NWD" # SAP System ID # Obs. This will be used also as identification number across different HA name resources. Duplicates are not allowed. -sap_ascs_instance_number = "00" +SAP_ASCS_INSTANCE_NUMBER = "00" # The central ABAP service instance number. Should follow the SAP rules for instance number naming. -# Example: sap_ascs_instance_number = "00" +# Example: SAP_ASCS_INSTANCE_NUMBER = "00" -sap_ers_instance_number = "01" +SAP_ERS_INSTANCE_NUMBER = "01" # The enqueue replication server instance number. Should follow the SAP rules for instance number naming. -# Example: sap_ers_instance_number = "01" +# Example: SAP_ERS_INSTANCE_NUMBER = "01" -sap_ci_instance_number = "10" +SAP_CI_INSTANCE_NUMBER = "10" # The primary application server instance number. Should follow the SAP rules for instance number naming. -# Example: sap_ci_instance_number = "10" +# Example: SAP_CI_INSTANCE_NUMBER = "10" -sap_aas_instance_number = "20" +SAP_AAS_INSTANCE_NUMBER = "20" # The additional application server instance number. Should follow the SAP rules for instance number naming. -# Example: sap_aas_instance_number = "20" +# Example: SAP_AAS_INSTANCE_NUMBER = "20" -hdb_concurrent_jobs = "23" +HDB_CONCURRENT_JOBS = "23" # Number of concurrent jobs used to load and/or extract archives to HANA Host ########################################################## # SAP S/4HANA APP Kit Paths ########################################################## -kit_sapcar_file = "/storage/S4HANA/SAPCAR_1010-70006178.EXE" -kit_swpm_file = "/storage/S4HANA/SWPM20SP13_1-80003424.SAR" -kit_sapexe_file = "/storage/S4HANA/SAPEXE_100-70005283.SAR" -kit_sapexedb_file = "/storage/S4HANA/SAPEXEDB_100-70005282.SAR" -kit_igsexe_file = "/storage/S4HANA/igsexe_1-70005417.sar" -kit_igshelper_file = "/storage/S4HANA/igshelper_17-10010245.sar" -kit_saphotagent_file = "/storage/S4HANA/SAPHOSTAGENT51_51-20009394.SAR" -kit_hdbclient_file = "/storage/S4HANA/IMDB_CLIENT20_009_28-80002082.SAR" -kit_s4hana_export = "/storage/S4HANA/export" +KIT_SAPCAR_FILE = "/storage/S4HANA/SAPCAR_1010-70006178.EXE" +KIT_SWPM_FILE = "/storage/S4HANA/SWPM20SP13_1-80003424.SAR" +KIT_SAPEXE_FILE = "/storage/S4HANA/SAPEXE_100-70005283.SAR" +KIT_SAPEXEDB_FILE = "/storage/S4HANA/SAPEXEDB_100-70005282.SAR" +KIT_IGSEXE_FILE = "/storage/S4HANA/igsexe_1-70005417.sar" +KIT_IGSHELPER_FILE = "/storage/S4HANA/igshelper_17-10010245.sar" +KIT_SAPHOSTAGENT_FILE = "/storage/S4HANA/SAPHOSTAGENT51_51-20009394.SAR" +KIT_HDBCLIENT_FILE = "/storage/S4HANA/IMDB_CLIENT20_009_28-80002082.SAR" +KIT_S4HANA_EXPORT = "/storage/S4HANA/export" ``` **SAP input parameters:** Parameter | Description | Requirements ----------|-------------|------------- -hana_sid | The SAP system ID identifies the SAP HANA system |
  • Consists of exactly three alphanumeric characters
  • Has a letter for the first character
  • Does not include any of the reserved IDs listed in SAP Note 1979280
| -hana_sysno | Specifies the instance number of the SAP HANA system|
  • Two-digit number from 00 to 97
  • Must be unique on a host
-hana_system_usage | System Usage | Default: custom
Valid values: production, test, development, custom -hana_components | SAP HANA Components | Default: server
Valid values: all, client, es, ets, lcapps, server, smartda, streaming, rdsync, xs, studio, afl, sca, sop, eml, rme, rtl, trp -kit_saphana_file | Path to SAP HANA ZIP file | As downloaded from SAP Support Portal -sap_sid | The SAP system ID identifies the entire SAP system |
  • Consists of exactly three alphanumeric characters
  • Has a letter for the first character
  • Does not include any of the reserved IDs listed in SAP Note 1979280
-sap_ascs_instance_number | Technical identifier for internal processes of ASCS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
-sap_ers_instance_number | Technical identifier for internal processes of ERS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
-sap_ci_instance_number | Technical identifier for internal processes of PAS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
-sap_aas_instance_number | Technical identifier for internal processes of AAS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
-hdb_concurrent_jobs | Number of concurrent jobs used to load and/or extract archives to HANA Host | Default: 23 -kit_sapcar_file | Path to sapcar binary | As downloaded from SAP Support Portal -kit_swpm_file | Path to SWPM archive (SAR) | As downloaded from SAP Support Portal -kit_sapexe_file | Path to SAP Kernel OS archive (SAR) | As downloaded from SAP Support Portal -kit_sapexedb_file | Path to SAP Kernel DB archive (SAR) | As downloaded from SAP Support Portal -kit_igsexe_file | Path to IGS archive (SAR) | As downloaded from SAP Support Portal -kit_igshelper_file | Path to IGS Helper archive (SAR) | As downloaded from SAP Support Portal +HANA_SID | The SAP system ID identifies the SAP HANA system |
  • Consists of exactly three alphanumeric characters
  • Has a letter for the first character
  • Does not include any of the reserved IDs listed in SAP Note 1979280
| +HANA_SYSNO | Specifies the instance number of the SAP HANA system|
  • Two-digit number from 00 to 97
  • Must be unique on a host
+HANA_SYSTEM_USAGE | System Usage | Default: custom
Valid values: production, test, development, custom +HANA_COMPONENTS | SAP HANA Components | Default: server
Valid values: all, client, es, ets, lcapps, server, smartda, streaming, rdsync, xs, studio, afl, sca, sop, eml, rme, rtl, trp +KIT_SAPHANA_FILE | Path to SAP HANA ZIP file | As downloaded from SAP Support Portal +SAP_SID | The SAP system ID identifies the entire SAP system |
  • Consists of exactly three alphanumeric characters
  • Has a letter for the first character
  • Does not include any of the reserved IDs listed in SAP Note 1979280
+SAP_ASCS_INSTANCE_NUMBER | Technical identifier for internal processes of ASCS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
+SAP_ERS_INSTANCE_NUMBER | Technical identifier for internal processes of ERS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
+SAP_CI_INSTANCE_NUMBER | Technical identifier for internal processes of PAS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
+SAP_AAS_INSTANCE_NUMBER | Technical identifier for internal processes of AAS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
+HDB_CONCURRENT_JOBS | Number of concurrent jobs used to load and/or extract archives to HANA Host | Default: 23 +KIT_SAPCAR_FILE | Path to sapcar binary | As downloaded from SAP Support Portal +KIT_SWPM_FILE | Path to SWPM archive (SAR) | As downloaded from SAP Support Portal +KIT_SAPEXE_FILE | Path to SAP Kernel OS archive (SAR) | As downloaded from SAP Support Portal +KIT_SAPEXEDB_FILE | Path to SAP Kernel DB archive (SAR) | As downloaded from SAP Support Portal +KIT_IGSEXE_FILE | Path to IGS archive (SAR) | As downloaded from SAP Support Portal +KIT_IGSHELPER_FILE | Path to IGS Helper archive (SAR) | As downloaded from SAP Support Portal kit_saphostagent_file | Path to SAP Host Agent archive (SAR) | As downloaded from SAP Support Portal -kit_hdbclient_file | Path to HANA DB client archive (SAR) | As downloaded from SAP Support Portal -kit_s4hana_export | Path to S/4HANA Installation Export dir | The archives downloaded from SAP Support Portal should be present in this path +KIT_HDBCLIENT_FILE | Path to HANA DB client archive (SAR) | As downloaded from SAP Support Portal +KIT_S4HANA_EXPORT | Path to S/4HANA Installation Export dir | The archives downloaded from SAP Support Portal should be present in this path **SAP Passwords** @@ -276,9 +286,9 @@ The passwords for the SAP system will be asked interactively during terraform pl Parameter | Description | Requirements ----------|-------------|------------- -sap_main_password | Common password for all users that are created during the installation |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
-hana_main_password | HANA system master password |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
  • Master Password must contain at least one upper-case character
-ha_password | HA cluster password |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
+SAP_MAIN_PASSWORD | Common password for all users that are created during the installation |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
+HANA_MAIN_PASSWORD | HANA system master password |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
  • Master Password must contain at least one upper-case character
+HA_PASSWORD | HA cluster password |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
**Obs***:
- Sensitive - The variable value is not displayed in your tf files details after terrafrorm plan&apply commands.
@@ -314,7 +324,7 @@ For planning phase: ```shell terraform plan --out plan1 -# you will be asked for the following sensitive variables: 'ibmcloud_api_key', 'sap_main_password' , 'hana_main_password' and 'ha_password'. +# you will be asked for the following sensitive variables: 'IBMCLOUD_API_KEY', 'SAP_MAIN_PASSWORD' , 'HANA_MAIN_PASSWORD' and 'HA_PASSWORD'. ``` For apply phase: @@ -328,7 +338,7 @@ For destroy: ```shell terraform destroy # you will be asked for the following sensitive variables as a destroy confirmation phase: -'ibmcloud_api_key', 'sap_main_password' , 'hana_main_password' and 'ha_password'. +'IBMCLOUD_API_KEY', 'SAP_MAIN_PASSWORD' , 'HANA_MAIN_PASSWORD' and 'HA_PASSWORD'. ``` ### Related links: diff --git a/cli/ansible/roles/hdbclusterhooks/tasks/main.yml b/cli/ansible/roles/hdbclusterhooks/tasks/main.yml index 77fc9b7..2d98227 100644 --- a/cli/ansible/roles/hdbclusterhooks/tasks/main.yml +++ b/cli/ansible/roles/hdbclusterhooks/tasks/main.yml @@ -16,6 +16,10 @@ group: sapsys mode: 0755 +- name: Pause for 15 minutes to allow all started processes to complete + ansible.builtin.pause: + minutes: 15 + - name: Stop HANADB instance shell: | /usr/sap/{{ hana_sid | upper }}/HDB{{ hana_sysno }}/HDB stop diff --git a/cli/ansible/roles/s4appreq/tasks/configurations/hostname_fix_RedHat.yml b/cli/ansible/roles/s4appreq/tasks/configurations/hostname_fix_RedHat.yml index 6e3dd62..3267f1f 100644 --- a/cli/ansible/roles/s4appreq/tasks/configurations/hostname_fix_RedHat.yml +++ b/cli/ansible/roles/s4appreq/tasks/configurations/hostname_fix_RedHat.yml @@ -16,4 +16,10 @@ path: /etc/hosts regexp: "^(?!{{ ansible_default_ipv4.address }}.*{{ sap_short_hostname.stdout }})(.*)({{ sap_short_hostname.stdout }}.*)" replace: '\1' + +- name: Disable ipv6 localhost + replace: + path: /etc/hosts + regexp: '^\:\:1(\s)' + replace: '# ::1 \1' ... diff --git a/cli/ansible/roles/s4appreq/tasks/configurations/kernel_RedHat7.yml b/cli/ansible/roles/s4appreq/tasks/configurations/kernel_RedHat7.yml deleted file mode 100644 index bc3cf49..0000000 --- a/cli/ansible/roles/s4appreq/tasks/configurations/kernel_RedHat7.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: Set recommended kernel parameters for RedHat 7 - sysctl: - sysctl_file: /etc/sysctl.d/sap.conf - name: "{{ kernel_param.name }}" - value: "{{ kernel_param.value }}" - sysctl_set: yes - state: present - reload: yes - loop: - - { name: kernel.sem, value: "1250 256000 100 1024" } - - { name: vm.max_map_count, value: 2147483647 } #900929 - Linux: STORAGE_PARAMETERS_WRONG_SET and "mmap() failed" - loop_control: - loop_var: kernel_param -... \ No newline at end of file diff --git a/cli/ansible/roles/s4appreq/tasks/configurations/update_RedHat7.yml b/cli/ansible/roles/s4appreq/tasks/configurations/update_RedHat7.yml deleted file mode 100644 index da9a854..0000000 --- a/cli/ansible/roles/s4appreq/tasks/configurations/update_RedHat7.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- name: Enable repository for compat-sap-c++-9 - rhsm_repository: - name: "{{ repo_name }}" - state: enabled - loop: - # - rhel-sap-for-rhel-7-server-e4s-rpms - - rhel-7-server-rpms - - rhel-sap-hana-for-rhel-7-server-rpms - - rhel-7-server-eus-rpms - - loop_control: - loop_var: repo_name - -- name: Update all packages # noqa 403 - yum: - name: '*' - state: latest -... diff --git a/cli/ansible/roles/s4appreq/vars/RedHat7.yml b/cli/ansible/roles/s4appreq/vars/RedHat7.yml deleted file mode 100644 index 4f6c4d0..0000000 --- a/cli/ansible/roles/s4appreq/vars/RedHat7.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -s4app_required_packages: - - uuidd - - compat-libstdc++-33 - - compat-sap-c++-6 - - lvm2 - - tcsh - - ksh -s4app_required_package_groups: - - "@large-systems" - - "@network-file-system-client" - - "@performance" - - "@compat-libraries" -s4app_required_configurations: - - "repository_RedHat" - - "update_RedHat7" - - "reqpkg" - - "reqpkggroups_RedHat" - - "hostname_fix_RedHat" - - "firewalld" - - "uuidd" - - "SELinux" - - "limits" - - "tmpfiles" - - "compatlibs" - - "kernel_RedHat7" - - "reboot" -... diff --git a/cli/ansible/roles/s4pasinst/tasks/main.yml b/cli/ansible/roles/s4pasinst/tasks/main.yml index d285f55..a4f6f05 100644 --- a/cli/ansible/roles/s4pasinst/tasks/main.yml +++ b/cli/ansible/roles/s4pasinst/tasks/main.yml @@ -1,4 +1,8 @@ --- +- name: Pause for 10 minutes to make sure HANA is up + ansible.builtin.pause: + minutes: 10 + - name: Generate parameter file for sapinst template: src: pasconfig.cfg diff --git a/cli/ansible/roles/saphanareq/filter_plugins/filesystemdata.py b/cli/ansible/roles/saphanareq/filter_plugins/filesystemdata.py new file mode 100644 index 0000000..8e1d443 --- /dev/null +++ b/cli/ansible/roles/saphanareq/filter_plugins/filesystemdata.py @@ -0,0 +1,64 @@ +#!/usr/bin/python + +class FilterModule(object): + '''Data related to filesystems for HANA VM''' + + def filters(self): + return { + 'filesystemdata': self.filesystemdata + } + + def filesystemdata(self, data_list): + final_list = [] + data_map = data_list[0] + sid = data_list[1] + for k, v in data_map.items(): + key_to_check = 'lvm' + if key_to_check in v: + for m in v['lvm']['lv']: + temp_list = [] + fs_device = "/dev/" + sid + "_" + v['lvm']['vg']['vg_name'] + "/" + sid + "_" + m['lv_name'] + mp = None + fs_options = "" + label = "" + mount_source = fs_device + if m['lv_name'] == 'hana_data_lv': + label = "HANA_DATA" + elif m['lv_name'] == 'hana_log_lv': + label = "HANA_LOG" + elif m['lv_name'] == 'hana_shared_lv': + label = "HANA_SHARED" + else: + label = "" + if label != "": + fs_options = "-L " + label + mount_source = "LABEL=" + label + if "mount_point" in m.keys(): + mp = m['mount_point'] + fs_info = { "fs_device": fs_device, "fs_type": m['fs_type'], "mp": mp, "fs_options": fs_options, "mount_source": mount_source } + temp_list.append(fs_info) + final_list.append(temp_list) + else: + temp_list = [] + fs_device = v['device'][0] + "1" + fs_options = "" + label = "" + mount_source = fs_device + mp = None + if "mount_point" in v.keys(): + mp = v['mount_point'] + if mp == "/hana/data": + label = "HANA_DATA" + elif mp == "/hana/log": + label = "HANA_LOG" + elif mp == "/hana/shared": + label = "HANA_SHARED" + else: + label = "" + if label != "": + fs_options = "-L " + label + mount_source = "LABEL=" + label + fs_info = { "fs_device": fs_device, "fs_type": v['fs_type'], "mp": mp, "fs_options": fs_options, "mount_source": mount_source } + temp_list.append(fs_info) + final_list.append(temp_list) + return final_list diff --git a/cli/ansible/roles/saphanareq/filter_plugins/lvmdata.py b/cli/ansible/roles/saphanareq/filter_plugins/lvmdata.py new file mode 100644 index 0000000..bedf950 --- /dev/null +++ b/cli/ansible/roles/saphanareq/filter_plugins/lvmdata.py @@ -0,0 +1,45 @@ +#!/usr/bin/python + +class FilterModule(object): + '''Data related to LVM for HANA VM''' + + def filters(self): + return { + 'lvmdata': self.lvmdata + } + + def lvmdata(self, data_map): + final_list = [] + for k, v in data_map.items(): + key_to_check = 'lvm' + if key_to_check in v: + # In case the sum of the sizes of all LVs from the VG is lower than VG size + # and we don't want 'hana_data_lv' to be created as '100%FREE' + lv100free = True + total_lv_size = 0 + vgsize = 0 + for t in v['disk_size']: + vgsize += int(t) + lvminfo = v['lvm']['lv'] + for n in lvminfo: + total_lv_size += int(n['lv_size']) + if vgsize > total_lv_size: + lv100free = False + for m in v['lvm']['lv']: + temp_list = [] + lv_size = "" + # For HANA VMs, SWAP size is always 2 GB + # The volume group 'hana_vg' will always contain logical volume 'hana_data_lv' + if k == 'swap' or (k == 'hana_vg' and m['lv_name'] != 'hana_data_lv') or (lv100free == False and k == 'hana_vg' and m['lv_name'] == 'hana_data_lv'): + lv_size = m['lv_size'] + "G" + else: + lv_size = '100%FREE' + lvm_info = { "vg_name": v['lvm']['vg']['vg_name'], "lv_name": m['lv_name'], "lv_size": lv_size, "lv_stripes": m['lv_stripes'], "lv_stripe_size": m['lv_stripe_size'] } + temp_list.append(lvm_info) + final_list.append(temp_list) + for i in range(len(final_list)): + # LVM data 'hana_data_lv' should be last in array (in case it will be created in 'hana_vg') as we want 100%FREE as size + if final_list[i][0]['vg_name'] == 'hana_vg' and final_list[i][0]['lv_name'] == 'hana_data_lv': + final_list.append(final_list.pop(i)) + break + return final_list diff --git a/cli/ansible/roles/saphanareq/filter_plugins/partitionlist.py b/cli/ansible/roles/saphanareq/filter_plugins/partitionlist.py new file mode 100644 index 0000000..dd8f7e1 --- /dev/null +++ b/cli/ansible/roles/saphanareq/filter_plugins/partitionlist.py @@ -0,0 +1,17 @@ +#!/usr/bin/python + +class FilterModule(object): + '''List of devices for partitions on HANA VM''' + + def filters(self): + return { + 'partitionlist': self.partitionlist + } + + def partitionlist(self, data_map): + final_list = [] + for k, v in data_map.items(): + key_to_check = 'lvm' + if key_to_check not in v: + final_list.append(v['device']) + return final_list diff --git a/cli/ansible/roles/saphanareq/filter_plugins/storagedetails.py b/cli/ansible/roles/saphanareq/filter_plugins/storagedetails.py new file mode 100644 index 0000000..4471592 --- /dev/null +++ b/cli/ansible/roles/saphanareq/filter_plugins/storagedetails.py @@ -0,0 +1,100 @@ +#!/usr/bin/python + +import decimal +import re + +class FilterModule(object): + '''Storage details from profile containing also the devices for HANA VM''' + + def filters(self): + return { + 'storagedetails': self.storagedetails + } + + def storagedetails(self, data_list): + # data_list[0] - json file data + # data_list[1] - ansible_devices data + # data_list[2] - selected storage profile + json_file_data = data_list[0] + ansible_devices_data = data_list[1] + hana_profile = data_list[2] + + storage_profile_info = json_file_data['profiles'][hana_profile]['storage'] + + # Create a sorted list with all disks device keys available on the VM + pattern = 'dm-' + all_disk_device_keys = sorted([item for item in ansible_devices_data if re.match(pattern, item) == None]) + + # Get the number of the disks to be configured + necessary_disks_number = "" + count_disks = 0 + for k, v in storage_profile_info.items(): + count_disks += int(v['disk_count']) + necessary_disks_number = str(count_disks) + + # Get a list with the device keys for disks to be configured + N = int(necessary_disks_number) + disk_device_keys = all_disk_device_keys[-N:] + + # Get a list with the provisioned disk sizes corresponding to the device keys for disks to be configured + size_provisioned_disks = [] + for m, n in ansible_devices_data.items(): + if m in disk_device_keys and 'KB' not in n['size']: + size_provisioned_disks.append(n['size']) + + # Sort the list with provisioned disk sizes + size_provisioned_disks_sorted = sorted(size_provisioned_disks) + + # Get a list of disk sizes corresponding to the selected profile + size_profile_disks = [] + for k, v in storage_profile_info.items(): + display_size = "" + if int(v['disk_size']) >= 1024: + rounded_val = round(decimal.Decimal(int(v['disk_size']) / 1024), 2) + no_decimal_places = abs(rounded_val.as_tuple().exponent) + if no_decimal_places == 0: + display_size = str(rounded_val) + ".00 TB" + elif no_decimal_places == 1: + display_size = str(rounded_val) + "0 TB" + elif no_decimal_places == 2: + display_size = str(rounded_val) + " TB" + else: + display_size = v['disk_size'] + ".00 GB" + for t in range(int(v['disk_count'])): + size_profile_disks.append(display_size) + + # Sort the list with disk sizes from profile + size_profile_disks_sorted = sorted(size_profile_disks) + + # Get the missing disks + if (len(list(set(size_profile_disks_sorted) - set(size_provisioned_disks_sorted))) > 0) or (len(size_profile_disks_sorted) != len(size_provisioned_disks_sorted)): + msg = "The disks required for profile '" + hana_profile + "' are missing. The following disks sizes are required: " + str(size_profile_disks_sorted)[1:-1] + ". The following disk sizes were deployed: " + str(size_provisioned_disks_sorted)[1:-1] + return msg + else: + temp_list = [] + for k, v in storage_profile_info.items(): + new_list1 = [] + new_list2 = [] + display_size = "" + if int(v['disk_size']) >= 1024: + rounded_val = round(decimal.Decimal(int(v['disk_size']) / 1024), 2) + no_decimal_places = abs(rounded_val.as_tuple().exponent) + if no_decimal_places == 0: + display_size = str(rounded_val) + ".00 TB" + elif no_decimal_places == 1: + display_size = str(rounded_val) + "0 TB" + elif no_decimal_places == 2: + display_size = str(rounded_val) + " TB" + else: + display_size = v['disk_size'] + ".00 GB" + for t in range(int(v['disk_count'])): + new_list1.append(v['disk_size']) + for m, n in ansible_devices_data.items(): + if (n['size'] == display_size) and (m in disk_device_keys) and (m not in temp_list): + new_list2.append("/dev/" + m) + temp_list.append(m) + break + storage_profile_info[k]['disk_size'] = new_list1 + storage_profile_info[k]['device'] = new_list2 + final_storage = storage_profile_info + return final_storage diff --git a/cli/ansible/roles/saphanareq/tasks/configurations/filesystems.yml b/cli/ansible/roles/saphanareq/tasks/configurations/filesystems.yml index 73c5479..4dccade 100644 --- a/cli/ansible/roles/saphanareq/tasks/configurations/filesystems.yml +++ b/cli/ansible/roles/saphanareq/tasks/configurations/filesystems.yml @@ -1,148 +1,116 @@ --- -- name: Get available storage devices for swap - set_fact: - swap_disk: "{{ swap_disk|default([]) + [device.key] }}" - when: - - not device.value.partitions - - not device.value.holders - - device.key is search('vd') - - device.value.size == swap_disk_size - loop: "{{ ansible_devices | dict2items }}" - loop_control: - loop_var: device - -- name: Check if the required storage device for swap is found +# Storage sizing +# https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc (Updated on 2023-03-08) +# https://cloud.ibm.com/docs/sap?topic=sap-storage-design-considerations#hana-iaas-mx2-16x128-32x256-configure (Updated on 2022-05-19) +# https://cloud.ibm.com/docs/sap?topic=sap-storage-design-considerations#hana-iaas-mx2-48x384-configure (Updated on 2022-05-19) +# SAP Notes: +# - 2779331 - HANA services use large SWAP memory (v5) + +- name: Check if the JSON file for SAP HANA storage configuration is available on Ansible controller + stat: + path: "{{ playbook_dir }}/hana_volume_layout.json" + register: json_storage_file_status + delegate_to: localhost + +- name: Fail if the JSON file is missing fail: - msg: "Could not find a free {{ swap_disk_size }} storage device for swap" - when: swap_disk is not defined + msg: "The file {{ playbook_dir }}/hana_volume_layout.json is missing." + when: not json_storage_file_status.stat.exists -- name: Create a volume group for swap - lvg: - vg: "{{ hana_sid|lower }}_swap_vg" - pvs: "/dev/{{ swap_disk[0] }}" - pesize: "32" +- name: Get the JSON file content + shell: "cat {{ playbook_dir }}/hana_volume_layout.json" + register: result + changed_when: false + when: json_storage_file_status.stat.exists + delegate_to: localhost -- name: Get available storage devices for HANA VG +- name: Save the JSON data to a variable as a fact set_fact: - data_disk: "{{ data_disk|default([]) + ['/dev/' + device.key] }}" - when: - - not device.value.partitions - - not device.value.holders - - device.key is search('vd') - - device.value.size == hana_disk_size - loop: "{{ ansible_devices | dict2items }}" - loop_control: - loop_var: device + jsondata: "{{ result.stdout | from_json }}" -- name: Check if the required storage device for HANA VG is found +- name: Check if the chosen profile is certified for HANA VSIs fail: - msg: "Could not find the required free {{ hana_disk_size }} storage devices for HANA VG" - when: data_disk|length < 3 + msg: "The chosen profile {{ hana_profile }} is not certified for HANA VSIs." + when: hana_profile not in jsondata.profiles.keys() -- name: Create a volume group for HANA DB - lvg: - vg: "{{ hana_sid|lower }}_hana_vg" - pvs: "{{ data_disk }}" - pesize: "32" +- name: Detect the appropriate disks to be configured + set_fact: + final_storage: "{{ [jsondata, ansible_devices, hana_profile] | list | storagedetails }}" -- name: Create a logical volume for swap - lvol: - vg: "{{ hana_sid|lower }}_swap_vg" - lv: "{{ hana_sid|lower }}_swap_lv" - size: "{{ swap_lv_size }}" +- name: Get the missing disks + fail: + msg: "{{ final_storage }}" + when: final_storage is not mapping -- name: Create a logical volume for HANA data - lvol: - vg: "{{ hana_sid|lower }}_hana_vg" - lv: "{{ hana_sid|lower }}_hana_data_lv" - size: "{{ hana_data_lv_size }}" - opts: -i3 -I256 +- name: Create the volume groups + lvg: + vg: "{{ hana_sid | lower }}_{{ stg_details.value.lvm.vg.vg_name }}" + pvs: "{{ stg_details.value.device | join(',') }}" + pesize: "{{ stg_details.value.lvm.vg.pe_size_MB }}" + loop: "{{ final_storage | dict2items }}" + loop_control: + loop_var: stg_details + when: '"lvm" in stg_details.value.keys()' -- name: Create a logical volume for HANA log +- name: Create the logical volumes lvol: - vg: "{{ hana_sid|lower }}_hana_vg" - lv: "{{ hana_sid|lower }}_hana_log_lv" - size: "{{ hana_log_lv_size }}" - opts: -i3 -I64 + vg: "{{ hana_sid|lower }}_{{ lvm_data[0]['vg_name'] }}" + lv: "{{ hana_sid|lower }}_{{ lvm_data[0]['lv_name'] }}" + size: "{{ lvm_data[0]['lv_size'] }}" + opts: "-i{{ lvm_data[0]['lv_stripes'] }} -I{{ lvm_data[0]['lv_stripe_size'] }}" + shrink: false + loop: "{{ final_storage | lvmdata }}" + loop_control: + loop_var: lvm_data + +- name: Create the partitions + parted: + device: "{{ part[0] }}" + number: 1 + label: gpt + state: present + loop: "{{ final_storage | partitionlist }}" + loop_control: + loop_var: part + +- name: Create the filesystems + filesystem: + fstype: "{{ fs_data[0]['fs_type'] }}" + dev: "{{ fs_data[0]['fs_device'] }}" + opts: "{{ fs_data[0]['fs_options'] }}" + loop: "{{ [final_storage, hana_sid | lower] | filesystemdata }}" + loop_control: + loop_var: fs_data -- name: Create a logical volume for HANA shared - lvol: - vg: "{{ hana_sid|lower }}_hana_vg" - lv: "{{ hana_sid|lower }}_hana_shared_lv" - size: "{{ hana_shared_lv_size }}" - opts: -i3 +- name: Mount the filesystems + mount: + path: "{{ mp_data[0]['mp'] }}" + src: "{{ mp_data[0]['mount_source'] }}" + fstype: "{{ mp_data[0]['fs_type'] }}" + state: mounted + loop: "{{ [final_storage, hana_sid | lower] | filesystemdata }}" + loop_control: + loop_var: mp_data + when: mp_data[0]['mp'] != None -- name: Create a logical volume for /usr/sap - lvol: - vg: "{{ hana_sid|lower }}_hana_vg" - lv: "{{ hana_sid|lower }}_sap_lv" - size: "{{ sap_lv_size }}" - opts: -i3 - -- name: Create a swap filesystem - filesystem: - fstype: swap - dev: "/dev/{{ hana_sid|lower }}_swap_vg/{{ hana_sid|lower }}_swap_lv" - -- name: Create filesystem for /hana/data - filesystem: - fstype: xfs - dev: "/dev/{{ hana_sid|lower }}_hana_vg/{{ hana_sid|lower }}_hana_data_lv" - -- name: Create filesystem for /hana/log - filesystem: - fstype: xfs - dev: "/dev/{{ hana_sid|lower }}_hana_vg/{{ hana_sid|lower }}_hana_log_lv" - -- name: Create filesystem for /hana/shared - filesystem: - fstype: xfs - dev: "/dev/{{ hana_sid|lower }}_hana_vg/{{ hana_sid|lower }}_hana_shared_lv" - -- name: Create filesystem for /usr/sap - filesystem: - fstype: xfs - dev: "/dev/{{ hana_sid|lower }}_hana_vg/{{ hana_sid|lower }}_sap_lv" - -- name: Add swap device to /etc/fstab - lineinfile: - path: /etc/fstab - regexp: "^/dev/{{ hana_sid|lower }}_swap_vg/{{ hana_sid|lower }}_swap_lv" - line: "/dev/{{ hana_sid|lower }}_swap_vg/{{ hana_sid|lower }}_swap_lv swap swap defaults 0 0" +- name: Get SWAP LV name + set_fact: + swap_lv: "{{ swap_data[0]['fs_device'] }}" + loop: "{{ [final_storage, hana_sid | lower] | filesystemdata }}" + loop_control: + loop_var: swap_data -- name: Check the current swap size +- name: Check the current SWAP size set_fact: hana_vm_swap: "{{ ansible_swaptotal_mb }}" -- name: Mount swap volume - command: swapon -a +- name: Mount SWAP volume + command: "swapon -av {{ swap_lv }}" when: hana_vm_swap == 0 -- name: Mount /hana/data and add it to /etc/fstab - mount: - path: "/hana/data" - src: "/dev/{{ hana_sid|lower }}_hana_vg/{{ hana_sid|lower }}_hana_data_lv" - fstype: xfs - state: mounted - -- name: Mount /hana/log and add it to /etc/fstab - mount: - path: "/hana/log" - src: "/dev/{{ hana_sid|lower }}_hana_vg/{{ hana_sid|lower }}_hana_log_lv" - fstype: xfs - state: mounted - -- name: Mount /hana/shared and add it to /etc/fstab - mount: - path: "/hana/shared" - src: "/dev/{{ hana_sid|lower }}_hana_vg/{{ hana_sid|lower }}_hana_shared_lv" - fstype: xfs - state: mounted - -- name: Mount /usr/sap and add it to /etc/fstab - mount: - path: "/usr/sap" - src: "/dev/{{ hana_sid|lower }}_hana_vg/{{ hana_sid|lower }}_sap_lv" - fstype: xfs - state: mounted +- name: Add SWAP device to /etc/fstab + lineinfile: + path: /etc/fstab + regexp: "^{{ swap_lv }}" + line: "{{ swap_lv }} swap swap defaults 0 0" ... diff --git a/cli/ansible/roles/saphanareq/tasks/configurations/hostname_fix_RedHat.yml b/cli/ansible/roles/saphanareq/tasks/configurations/hostname_fix_RedHat.yml index 6e3dd62..db58986 100644 --- a/cli/ansible/roles/saphanareq/tasks/configurations/hostname_fix_RedHat.yml +++ b/cli/ansible/roles/saphanareq/tasks/configurations/hostname_fix_RedHat.yml @@ -16,4 +16,11 @@ path: /etc/hosts regexp: "^(?!{{ ansible_default_ipv4.address }}.*{{ sap_short_hostname.stdout }})(.*)({{ sap_short_hostname.stdout }}.*)" replace: '\1' + +- name: Disable ipv6 localhost + replace: + path: /etc/hosts + regexp: '^\:\:1(\s)' + replace: '# ::1 \1' + ... diff --git a/cli/ansible/roles/saphanareq/tasks/configurations/kernel_RedHat7.yml b/cli/ansible/roles/saphanareq/tasks/configurations/kernel_RedHat7.yml deleted file mode 100644 index fd519a8..0000000 --- a/cli/ansible/roles/saphanareq/tasks/configurations/kernel_RedHat7.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: Set recommended kernel parameters for SAP HANA DB on RedHat 7 - sysctl: - sysctl_file: /etc/sysctl.d/sap.conf - name: "{{ kernel_param.name }}" - value: "{{ kernel_param.value }}" - sysctl_set: yes - state: present - reload: yes - loop: - - { name: net.core.somaxconn, value: 4096 } - - { name: net.ipv4.tcp_max_syn_backlog, value: 8192 } - - { name: net.ipv4.tcp_slow_start_after_idle, value: 0 } - - { name: net.ipv4.tcp_syn_retries, value: 8 } - loop_control: - loop_var: kernel_param -... \ No newline at end of file diff --git a/cli/ansible/roles/saphanareq/tasks/configurations/tmpfs.yml b/cli/ansible/roles/saphanareq/tasks/configurations/tmpfs.yml new file mode 100644 index 0000000..ef306ad --- /dev/null +++ b/cli/ansible/roles/saphanareq/tasks/configurations/tmpfs.yml @@ -0,0 +1,49 @@ +--- +# TMPFS sizing +# SAP Notes: +# - 2772999 - Red Hat Enterprise Linux 8.x: Installation and Configuration (v22) +# - 941735 - SAP memory management system for 64-bit Linux systems (v11) + +- name: Get the RAM size + set_fact: + hana_ram_g: "{{ hana_profile.split('-')[1].split('x')[1] }}" + +- name: Set swap logical volume size for RAM higher than 8192 + set_fact: + swap_lv_size_g: "2" + +- name: Get the current tmpfs mount data + shell: set -o pipefail && df -h |grep tmpfs|grep shm| awk '{print $2}' + args: + executable: /bin/bash + register: tmpfs_crt_data + changed_when: false + when: swap_lv_size_g is defined + +- name: Compute tmpfs size + set_fact: + tmpfs_size_g: "{{ ((hana_ram_g | float + swap_lv_size_g | float) * 0.75) | round | int }}" + +- name: Current tmpfs size + set_fact: + crt_tmpfs_size_g: "{{ tmpfs_crt_data.stdout | regex_search('^[0-9]+') | float | round | int }}" + +- name: Difference between current size and expected one + set_fact: + difference_size: "{{ (crt_tmpfs_size_g | float - tmpfs_size_g | float) | abs }}" + +- name: Remount tmpfs + mount: + path: /dev/shm + src: tmpfs + fstype: tmpfs + opts: "size={{ tmpfs_size_g }}G,rw,nosuid,nodev 0 0" + state: remounted + when: difference_size | int > 1 + +- name: Add tmpfs device to /etc/fstab + lineinfile: + path: /etc/fstab + regexp: "^/dev/shm (.*)$" + line: "tmpfs /dev/shm tmpfs size={{ tmpfs_size_g }}G,rw,nosuid,nodev 0 0" +... diff --git a/cli/ansible/roles/saphanareq/tasks/configurations/update_RedHat7.yml b/cli/ansible/roles/saphanareq/tasks/configurations/update_RedHat7.yml deleted file mode 100644 index 4824910..0000000 --- a/cli/ansible/roles/saphanareq/tasks/configurations/update_RedHat7.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -- name: Enable repository for compat-sap-c++-9 - rhsm_repository: - name: "{{ repo_name }}" - state: enabled - loop: - # - rhel-sap-for-rhel-7-server-e4s-rpms - - rhel-7-server-rpms - - rhel-sap-hana-for-rhel-7-server-rpms - - rhel-7-server-eus-rpms - loop_control: - loop_var: repo_name - -- name: Update all packages # noqa 403 - yum: - name: '*' - state: latest -... diff --git a/cli/ansible/roles/saphanareq/vars/RedHat7.yml b/cli/ansible/roles/saphanareq/vars/RedHat7.yml deleted file mode 100644 index 526ee96..0000000 --- a/cli/ansible/roles/saphanareq/vars/RedHat7.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -saphana_required_packages: - - expect - - krb5-workstation - - krb5-libs - - libaio - - libcanberra-gtk2 - - libicu - - libssh2 - - libtool-ltdl - - numactl - - openssl - - PackageKit-gtk3-module - - rsyslog - - sudo - - tcsh - - rsyslog - - xorg-x11-xauth - - xulrunner - - gtk2 - - cairo - - graphviz - - iptraf-ng - - lm_sensors - - nfs-utils - - bind-utils - - net-tools - - compat-sap-c++-9 - - libatomic - - chrony - -saphana_required_package_groups: - - "@base" - -saphana_required_configurations: - - "repository_RedHat" - - "update_RedHat7" - - "reqpkggroups_RedHat" - - "reqpkg" - - "hostname_fix_RedHat" - - "filesystems" - - "tuned" - - "SELinux" - - "firewalld" - - "symlinks" - - "abrtd" - - "kdump" - - "limits" - - "tmpfiles" - - "kernel_RedHat7" - - "reboot" -... diff --git a/cli/ansible/roles/saphanareq/vars/RedHat8.yml b/cli/ansible/roles/saphanareq/vars/RedHat8.yml index 38a79ca..7c8f2c9 100644 --- a/cli/ansible/roles/saphanareq/vars/RedHat8.yml +++ b/cli/ansible/roles/saphanareq/vars/RedHat8.yml @@ -42,6 +42,7 @@ saphana_required_configurations: - "umask_RHEL" - "kernel_RedHat8" - "filesystems" + - "tmpfs" - "tuned" - "SELinux" - "firewalld" diff --git a/cli/files/hana_volume_layout.json b/cli/files/hana_volume_layout.json new file mode 100644 index 0000000..49f5612 --- /dev/null +++ b/cli/files/hana_volume_layout.json @@ -0,0 +1,1477 @@ +{ + "profiles": { + "mx2-16x128": { + "storage": { + "hana_vg": { + "disk_size": "500", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "988", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + }, + { + "lv_name": "hana_log_lv", + "lv_size": "256", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + }, + { + "lv_name": "hana_shared_lv", + "lv_size": "256", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"], + "sap_business_one": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4"] + } + }, + "mx2-32x256": { + "storage": { + "hana_vg": { + "disk_size": "500", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "988", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + }, + { + "lv_name": "hana_log_lv", + "lv_size": "256", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + }, + { + "lv_name": "hana_shared_lv", + "lv_size": "256", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"], + "sap_business_one": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4"] + } + }, + "mx2-48x384": { + "storage": { + "hana_vg": { + "disk_size": "500", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "616", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + }, + { + "lv_name": "hana_shared_lv", + "lv_size": "384", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "log": { + "disk_size": "100", + "disk_count": "4", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "400", + "lv_stripes": "4", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"], + "sap_business_one": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4"] + } + }, + "vx2d-16x224": { + "storage": { + "hana_vg": { + "disk_size": "1120", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "672", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + }, + { + "lv_name": "hana_log_lv", + "lv_size": "224", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + }, + { + "lv_name": "hana_shared_lv", + "lv_size": "224", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "vx2d-44x616": { + "storage": { + "data": { + "disk_size": "1848", + "disk_count": "1", + "iops": "10iops-tier", + "fs_type": "xfs", + "mount_point": "/hana/data" + }, + "shared": { + "disk_size": "616", + "disk_count": "1", + "iops": "5iops-tier", + "fs_type": "xfs", + "mount_point": "/hana/shared" + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"], + "olap": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "vx2d-88x1232": { + "storage": { + "data": { + "disk_size": "3696", + "disk_count": "1", + "iops": "10iops-tier", + "fs_type": "xfs", + "mount_point": "/hana/data" + }, + "shared": { + "disk_size": "1232", + "disk_count": "1", + "iops": "5iops-tier", + "fs_type": "xfs", + "mount_point": "/hana/shared" + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"], + "olap": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "vx2d-144x2016": { + "storage": { + "data": { + "disk_size": "1024", + "disk_count": "4", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_data_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "4096", + "lv_stripes": "4", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + } + ] + } + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "shared": { + "disk_size": "2016", + "disk_count": "1", + "iops": "5iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_shared_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_shared_lv", + "lv_size": "2016", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"], + "olap": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "vx2d-176x2464": { + "storage": { + "data": { + "disk_size": "1280", + "disk_count": "4", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_data_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "5120", + "lv_stripes": "4", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + } + ] + } + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "shared": { + "disk_size": "2464", + "disk_count": "1", + "iops": "5iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_shared_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_shared_lv", + "lv_size": "2464", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"], + "olap": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "ux2d-8x224": { + "storage": { + "hana_vg": { + "disk_size": "1120", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "672", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + }, + { + "lv_name": "hana_log_lv", + "lv_size": "224", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + }, + { + "lv_name": "hana_shared_lv", + "lv_size": "224", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "ux2d-16x448": { + "storage": { + "hana_vg": { + "disk_size": "2240", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "1344", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + }, + { + "lv_name": "hana_log_lv", + "lv_size": "448", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + }, + { + "lv_name": "hana_shared_lv", + "lv_size": "448", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "ux2d-36x1008": { + "storage": { + "data": { + "disk_size": "1008", + "disk_count": "2", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_data_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "2016", + "lv_stripes": "2", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + } + ] + } + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "shared": { + "disk_size": "1008", + "disk_count": "1", + "iops": "5iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_shared_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_shared_lv", + "lv_size": "1008", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "ux2d-48x1344": { + "storage": { + "data": { + "disk_size": "1350", + "disk_count": "2", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_data_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "2700", + "lv_stripes": "2", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + } + ] + } + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "shared": { + "disk_size": "1344", + "disk_count": "1", + "iops": "5iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_shared_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_shared_lv", + "lv_size": "1344", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "ux2d-72x2016": { + "storage": { + "data": { + "disk_size": "1024", + "disk_count": "4", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_data_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "4096", + "lv_stripes": "4", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + } + ] + } + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "shared": { + "disk_size": "2016", + "disk_count": "1", + "iops": "5iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_shared_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_shared_lv", + "lv_size": "2016", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "ux2d-100x2800": { + "storage": { + "data": { + "disk_size": "2100", + "disk_count": "4", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_data_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "8400", + "lv_stripes": "4", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + } + ] + } + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "shared": { + "disk_size": "2800", + "disk_count": "1", + "iops": "5iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_shared_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_shared_lv", + "lv_size": "2800", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "ux2d-200x5600": { + "storage": { + "data": { + "disk_size": "4200", + "disk_count": "4", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_data_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "16800", + "lv_stripes": "4", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + } + ] + } + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "shared": { + "disk_size": "5600", + "disk_count": "1", + "iops": "5iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_shared_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_shared_lv", + "lv_size": "5600", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + } + } + } \ No newline at end of file diff --git a/cli/input.auto.tfvars b/cli/input.auto.tfvars index 50c33fc..aba932c 100644 --- a/cli/input.auto.tfvars +++ b/cli/input.auto.tfvars @@ -18,15 +18,15 @@ DOMAIN_NAME = "example.com" # You can't use a domain name that is already in use. # Domain names are not case sensitive. -ASCS-VIRT-HOSTNAME = "sapascs" -# ASCS Virtual hostname​ +ASCS_VIRT_HOSTNAME = "sapascs" +# ASCS Virtual Hostname # Default = "sap($your_sap_sid)ascs" -ERS-VIRT-HOSTNAME = "sapers" -# ERS Virtual Hostname​ +ERS_VIRT_HOSTNAME = "sapers" +# ERS Virtual Hostname # Default = "sap($your_sap_sid)ascs" -HANA-VIRT-HOSTNAME = "dbhana" +HANA_VIRT_HOSTNAME = "dbhana" # Hana Virtual Hostname # Default = "db($your_hana_sid)hana" @@ -55,125 +55,130 @@ SSH_KEYS = [ "r010-57bfc315-f9e5-46bf-bf61-d87a24a9ce7a", "r010-3fcd9fe7-d4a7-41 # File Shares variables: ########################################################## -share_profile = "tier-5iops" -# Enter the IOPs (IOPS per GB) tier for File Share storage. "Enter the IOPs (IOPS per GB) tier for File Share storage. -# Valid values are: tier-3iops, tier-5iops, tier-10iops. - -# File shares sizes: -usrsap-as1 = "20" -usrsap-as2 = "20" -usrsap-sapascs = "20" -usrsap-sapers = "20" -usrsap-sapmnt = "20" -usrsap-sapsys = "20" -usrsap-trans = "80" +SHARE_PROFILE = "dp2" +# Enter the File Share Storage Profile. +# More details on https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles&interface=ui#dp2-profile." + +# Default File shares sizes: +USRSAP_AS1 = "20" +USRSAP_AS2 = "20" +USRSAP_SAPASCS = "20" +USRSAP_SAPERS = "20" +USRSAP_SAPMNT = "20" +USRSAP_SAPSYS = "20" +USRSAP_TRANS = "80" # Enter Custom File Shares sizes for SAP mounts. ########################################################## # DB VSI variables: ########################################################## -DB-HOSTNAME-1 = "hanadb-1" + +DB_HOSTNAME_1 = "hanadb-1" # Hana Cluster VSI1 Hostname. # The Hostname for the DB VSI. The hostname should be up to 13 characters, as required by SAP -# Default: DB-HOSTNAME-1 = "hanadb-$your_hana_sid-1" +# Default: DB_HOSTNAME_1 = "hanadb-$your_hana_sid-1" -DB-HOSTNAME-2 = "hanadb-2" +DB_HOSTNAME_2 = "hanadb-2" # Hana Cluster VSI2 Hostname. # The Hostname for the DB VSI. The hostname should be up to 13 characters, as required by SAP -# Default: DB-HOSTNAME-2 = "hanadb-$your_hana_sid-2" +# Default: DB_HOSTNAME_2 = "hanadb-$your_hana_sid-2" -DB-PROFILE = "mx2-16x128" -# The DB VSI profile. Supported profiles for DB VSI: mx2-16x128. The list of available profiles: https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui +DB_PROFILE = "mx2-16x128" +# The instance profile used for the HANA VSI. The list of certified profiles for HANA VSIs: https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc +# Details about all x86 instance profiles: https://cloud.ibm.com/docs/vpc?topic=vpc-profiles). +# For more information about supported DB/OS and IBM Gen 2 Virtual Server Instances (VSI), check [SAP Note 2927211: SAP Applications on IBM Virtual Private Cloud](https://launchpad.support.sap.com/#/notes/2927211) +# Default value: "mx2-16x128" -DB-IMAGE = "ibm-redhat-8-6-amd64-sap-hana-2" +DB_IMAGE = "ibm-redhat-8-6-amd64-sap-hana-2" # OS image for DB VSI. Supported OS images for DB VSIs: ibm-redhat-8-4-amd64-sap-hana-4 # The list of available VPC Operating Systems supported by SAP: SAP note '2927211 - SAP Applications on IBM Virtual Private Cloud (VPC) Infrastructure environment' https://launchpad.support.sap.com/#/notes/2927211; The list of all available OS images: https://cloud.ibm.com/docs/vpc?topic=vpc-about-images -# Example: DB-IMAGE = "ibm-redhat-8-4-amd64-sap-hana-4" +# Example: DB_IMAGE = "ibm-redhat-8-4-amd64-sap-hana-4" ########################################################## # SAP APP VSI variables: ########################################################## -APP-HOSTNAME-1 = "sapapp-1" + +APP_HOSTNAME_1 = "sapapp-1" # SAP Cluster VSI1 Hostname. # The Hostname for the SAP APP VSI. The hostname should be up to 13 characters, as required by SAP -# Default: APP-HOSTNAME-1 = "sapapp-$your_sap_sid-1" +# Default: APP_HOSTNAME_1 = "sapapp-$your_sap_sid-1" -APP-HOSTNAME-2 = "sapapp-2" +APP_HOSTNAME_2 = "sapapp-2" # SAP Cluster VSI2 Hostname. # The Hostname for the SAP APP VSI. The hostname should be up to 13 characters, as required by SAP -# Default: APP-HOSTNAME-2 = "sapapp-$your_sap_sid-2" +# Default: APP_HOSTNAME_2 = "sapapp-$your_sap_sid-2" -APP-PROFILE = "bx2-4x16" +APP_PROFILE = "bx2-4x16" # The APP VSI profile. Supported profiles: bx2-4x16. The list of available profiles: https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui -APP-IMAGE = "ibm-redhat-8-6-amd64-sap-hana-2" +APP_IMAGE = "ibm-redhat-8-6-amd64-sap-hana-2" # OS image for SAP APP VSI. Supported OS images for APP VSIs: ibm-redhat-8-4-amd64-sap-hana-4. # The list of available VPC Operating Systems supported by SAP: SAP note '2927211 - SAP Applications on IBM Virtual Private Cloud (VPC) Infrastructure environment' https://launchpad.support.sap.com/#/notes/2927211; The list of all available OS images: https://cloud.ibm.com/docs/vpc?topic=vpc-about-images -# Example: APP-IMAGE = "ibm-redhat-8-4-amd64-sap-hana-4" +# Example: APP_IMAGE = "ibm-redhat-8-4-amd64-sap-hana-4" ########################################################## # SAP HANA configuration ########################################################## -hana_sid = "HDB" +HANA_SID = "HDB" # SAP HANA system ID. Should follow the SAP rules for SID naming. # Obs. This will be used also as identification number across different HA name resources. Duplicates are not allowed. -# Example: hana_sid = "HDB" +# Example: HANA_SID = "HDB" -hana_sysno = "00" +HANA_SYSNO = "00" # SAP HANA instance number. Should follow the SAP rules for instance number naming. -# Example: hana_sysno = "00" +# Example: HANA_SYSNO = "00" -hana_system_usage = "custom" +HANA_SYSTEM_USAGE = "custom" # System usage. Default: custom. Suported values: production, test, development, custom -# Example: hana_system_usage = "custom" +# Example: HANA_SYSTEM_USAGE = "custom" -hana_components = "server" +HANA_COMPONENTS = "server" # SAP HANA Components. Default: server. Supported values: all, client, es, ets, lcapps, server, smartda, streaming, rdsync, xs, studio, afl, sca, sop, eml, rme, rtl, trp -# Example: hana_components = "server" +# Example: HANA_COMPONENTS = "server" -kit_saphana_file = "/storage/HANADB/51055299.ZIP" +KIT_SAPHANA_FILE = "/storage/HANADB/51055299.ZIP" # SAP HANA Installation kit path # Supported SAP HANA versions on Red Hat 8.4, 8.6 and Suse 15.3, 15.4: HANA 2.0 SP 5 Rev 57, kit file: 51055299.ZIP -# Example for Red Hat 8 or Suse 15: kit_saphana_file = "/storage/HANADB/51055299.ZIP" +# Example for Red Hat 8 or Suse 15: KIT_SAPHANA_FILE = "/storage/HANADB/51055299.ZIP" ########################################################## # SAP system configuration ########################################################## -sap_sid = "S4A" +SAP_SID = "S4A" # SAP System ID # Obs. This will be used also as identification number across different HA name resources. Duplicates are not allowed. -sap_ascs_instance_number = "00" +SAP_ASCS_INSTANCE_NUMBER = "00" # The central ABAP service instance number. Should follow the SAP rules for instance number naming. -# Example: sap_ascs_instance_number = "00" +# Example: SAP_ASCS_INSTANCE_NUMBER = "00" -sap_ers_instance_number = "01" +SAP_ERS_INSTANCE_NUMBER = "01" # The enqueue replication server instance number. Should follow the SAP rules for instance number naming. -# Example: sap_ers_instance_number = "01" +# Example: SAP_ERS_INSTANCE_NUMBER = "01" -sap_ci_instance_number = "10" +SAP_CI_INSTANCE_NUMBER = "10" # The primary application server instance number. Should follow the SAP rules for instance number naming. -# Example: sap_ci_instance_number = "10" +# Example: SAP_CI_INSTANCE_NUMBER = "10" -sap_aas_instance_number = "20" +SAP_AAS_INSTANCE_NUMBER = "20" # The additional application server instance number. Should follow the SAP rules for instance number naming. -# Example: sap_aas_instance_number = "20" +# Example: SAP_AAS_INSTANCE_NUMBER = "20" -hdb_concurrent_jobs = "23" +HDB_CONCURRENT_JOBS = "23" # Number of concurrent jobs used to load and/or extract archives to HANA Host ########################################################## # SAP S/4HANA APP Kit Paths ########################################################## -kit_sapcar_file = "/storage/S4HANA/SAPCAR_1010-70006178.EXE" -kit_swpm_file = "/storage/S4HANA/SWPM20SP13_1-80003424.SAR" -kit_sapexe_file = "/storage/S4HANA/SAPEXE_100-70005283.SAR" -kit_sapexedb_file = "/storage/S4HANA/SAPEXEDB_100-70005282.SAR" -kit_igsexe_file = "/storage/S4HANA/igsexe_1-70005417.sar" -kit_igshelper_file = "/storage/S4HANA/igshelper_17-10010245.sar" -kit_saphotagent_file = "/storage/S4HANA/SAPHOSTAGENT51_51-20009394.SAR" -kit_hdbclient_file = "/storage/S4HANA/IMDB_CLIENT20_009_28-80002082.SAR" -kit_s4hana_export = "/storage/S4HANA/export" +KIT_SAPCAR_FILE = "/storage/S4HANA/SAPCAR_1010-70006178.EXE" +KIT_SWPM_FILE = "/storage/S4HANA/SWPM20SP13_1-80003424.SAR" +KIT_SAPEXE_FILE = "/storage/S4HANA/SAPEXE_100-70005283.SAR" +KIT_SAPEXEDB_FILE = "/storage/S4HANA/SAPEXEDB_100-70005282.SAR" +KIT_IGSEXE_FILE = "/storage/S4HANA/igsexe_1-70005417.sar" +KIT_IGSHELPER_FILE = "/storage/S4HANA/igshelper_17-10010245.sar" +KIT_SAPHOSTAGENT_FILE = "/storage/S4HANA/SAPHOSTAGENT51_51-20009394.SAR" +KIT_HDBCLIENT_FILE = "/storage/S4HANA/IMDB_CLIENT20_009_28-80002082.SAR" +KIT_S4HANA_EXPORT = "/storage/S4HANA/export" diff --git a/cli/integration.tf b/cli/integration.tf index 81452e1..8188572 100644 --- a/cli/integration.tf +++ b/cli/integration.tf @@ -9,13 +9,13 @@ resource "local_file" "ha_ansible_infra-vars" { depends_on = [ module.db-vsi ] content = <<-DOC --- -#Ansible vars_file containing variable values passed from Terraform. -#Generated by "terraform plan&apply" command. +# Ansible vars_file containing variable values passed from Terraform. +# Generated by "terraform plan&apply" command. # INFRA variables -api_key: "${var.ibmcloud_api_key}" +api_key: "${var.IBMCLOUD_API_KEY}" region: "${var.REGION}" -ha_password: "${var.ha_password}" +ha_password: "${var.HA_PASSWORD}" hdb_iphost1: "${data.ibm_is_instance.db-vsi-1.primary_network_interface[0].primary_ip[0].address}" hdb_iphost2: "${data.ibm_is_instance.db-vsi-2.primary_network_interface[0].primary_ip[0].address}" @@ -46,29 +46,29 @@ resource "local_file" "app_ansible_saps4app-vars" { depends_on = [ module.db-vsi ] content = <<-DOC --- -#Ansible vars_file containing variable values passed from Terraform. -#Generated by "terraform plan&apply" command. +# Ansible vars_file containing variable values passed from Terraform. +# Generated by "terraform plan&apply" command. #SAP system configuration -sap_sid: "${var.sap_sid}" -sap_ascs_instance_number: "${var.sap_ascs_instance_number}" -sap_ers_instance_number: "${var.sap_ers_instance_number}" -sap_ci_instance_number: "${var.sap_ci_instance_number}" -sap_aas_instance_number: "${var.sap_aas_instance_number}" -sap_main_password: "${var.sap_main_password}" +sap_sid: "${var.SAP_SID}" +sap_ascs_instance_number: "${var.SAP_ASCS_INSTANCE_NUMBER}" +sap_ers_instance_number: "${var.SAP_ERS_INSTANCE_NUMBER}" +sap_ci_instance_number: "${var.SAP_CI_INSTANCE_NUMBER}" +sap_aas_instance_number: "${var.SAP_AAS_INSTANCE_NUMBER}" +sap_main_password: "${var.SAP_MAIN_PASSWORD}" -hdb_concurrent_jobs: "${var.hdb_concurrent_jobs}" +hdb_concurrent_jobs: "${var.HDB_CONCURRENT_JOBS}" #SAP S/4HANA APP Installation kit path -kit_sapcar_file: "${var.kit_sapcar_file}" -kit_swpm_file: "${var.kit_swpm_file}" -kit_sapexe_file: "${var.kit_sapexe_file}" -kit_sapexedb_file: "${var.kit_sapexedb_file}" -kit_igsexe_file: "${var.kit_igsexe_file}" -kit_igshelper_file: "${var.kit_igshelper_file}" -kit_saphotagent_file: "${var.kit_saphotagent_file}" -kit_hdbclient_file: "${var.kit_hdbclient_file}" -kit_s4hana_export: "${var.kit_s4hana_export}" +kit_sapcar_file: "${var.KIT_SAPCAR_FILE}" +kit_swpm_file: "${var.KIT_SWPM_FILE}" +kit_sapexe_file: "${var.KIT_SAPEXE_FILE}" +kit_sapexedb_file: "${var.KIT_SAPEXEDB_FILE}" +kit_igsexe_file: "${var.KIT_IGSEXE_FILE}" +kit_igshelper_file: "${var.KIT_IGSHELPER_FILE}" +kit_saphotagent_file: "${var.KIT_SAPHOSTAGENT_FILE}" +kit_hdbclient_file: "${var.KIT_HDBCLIENT_FILE}" +kit_s4hana_export: "${var.KIT_S4HANA_EXPORT}" ... DOC filename = "ansible/saps4app-vars.yml" @@ -80,19 +80,19 @@ resource "local_file" "db_ansible_saphana-vars" { depends_on = [ module.db-vsi ] content = <<-DOC --- -#Ansible vars_file containing variable values passed from Terraform. -#Generated by "terraform plan&apply" command. +# Ansible vars_file containing variable values passed from Terraform. +# Generated by "terraform plan&apply" command. +hana_profile: "${var.DB_PROFILE}" -#HANA DB configuration -hana_sid: "${var.hana_sid}" -hana_profile: "${var.DB-PROFILE}" -hana_sysno: "${var.hana_sysno}" -hana_main_password: "${var.hana_main_password}" -hana_system_usage: "${var.hana_system_usage}" -hana_components: "${var.hana_components}" +# HANA DB configuration +hana_sid: "${var.HANA_SID}" +hana_sysno: "${var.HANA_SYSNO}" +hana_main_password: "${var.HANA_MAIN_PASSWORD}" +hana_system_usage: "${var.HANA_SYSTEM_USAGE}" +hana_components: "${var.HANA_COMPONENTS}" #SAP HANA Installation kit path -kit_saphana_file: "${var.kit_saphana_file}" +kit_saphana_file: "${var.KIT_SAPHANA_FILE}" ... DOC filename = "ansible/saphana-vars.yml" @@ -110,3 +110,10 @@ resource "null_resource" "file_shares_ansible_vars" { EOF } } + +# Export Terraform variable values to an Ansible var_file +resource "local_file" "tf_ansible_hana_storage_generated_file" { + depends_on = [ module.db-vsi ] + source = "files/hana_volume_layout.json" + filename = "ansible/hana_volume_layout.json" +} diff --git a/cli/main.tf b/cli/main.tf index 59084ae..4eb1adc 100644 --- a/cli/main.tf +++ b/cli/main.tf @@ -11,7 +11,7 @@ module "pg" { ZONE = var.ZONE VPC = var.VPC RESOURCE_GROUP = var.RESOURCE_GROUP - SAP_SID = var.sap_sid + SAP_SID = var.SAP_SID } module "db-vsi" { @@ -23,20 +23,18 @@ module "db-vsi" { SUBNET = var.SUBNET RESOURCE_GROUP = var.RESOURCE_GROUP PLACEMENT_GROUP = module.pg.PLACEMENT_GROUP - PROFILE = var.DB-PROFILE - IMAGE = var.DB-IMAGE + PROFILE = var.DB_PROFILE + IMAGE = var.DB_IMAGE SSH_KEYS = var.SSH_KEYS - VOLUME_SIZES = [ "500" , "500" , "500" , "10" ] - VOL_PROFILE = "10iops-tier" - SAP_SID = var.sap_sid + SAP_SID = var.SAP_SID for_each ={ - "hanadb-1" = {DB-HOSTNAME = "${var.DB-HOSTNAME-1}" , DB-HOSTNAME-DEFAULT = "hanadb-${var.hana_sid}-1"} - "hanadb-2" = {DB-HOSTNAME = "${var.DB-HOSTNAME-2}" , DB-HOSTNAME-DEFAULT = "hanadb-${var.hana_sid}-2"} + "hanadb-1" = { DB-HOSTNAME = lower("${var.DB_HOSTNAME_1}") , DB-HOSTNAME-DEFAULT = lower("hanadb-${var.HANA_SID}-1"), DB_REAL_HOSTNAME = lower("${var.DB_HOSTNAME_1}") != "hanadb-1" ? lower("${var.DB_HOSTNAME_1}") : lower("hanadb-${var.HANA_SID}-1") } + "hanadb-2" = { DB-HOSTNAME = lower("${var.DB_HOSTNAME_2}") , DB-HOSTNAME-DEFAULT = lower("hanadb-${var.HANA_SID}-2"), DB_REAL_HOSTNAME = lower("${var.DB_HOSTNAME_2}") != "hanadb-2" ? lower("${var.DB_HOSTNAME_2}") : lower("hanadb-${var.HANA_SID}-2") } } DB-HOSTNAME = "${each.value.DB-HOSTNAME}" INPUT-DEFAULT-HOSTNAME = "${each.key}" FINAL-DEFAULT-HOSTNAME = lower ("${each.value.DB-HOSTNAME-DEFAULT}") - + REAL_HOSTNAME = "${each.value.DB_REAL_HOSTNAME}" } module "app-vsi" { @@ -48,81 +46,55 @@ module "app-vsi" { SUBNET = var.SUBNET RESOURCE_GROUP = var.RESOURCE_GROUP PLACEMENT_GROUP = module.pg.PLACEMENT_GROUP - PROFILE = var.APP-PROFILE - IMAGE = var.APP-IMAGE + PROFILE = var.APP_PROFILE + IMAGE = var.APP_IMAGE SSH_KEYS = var.SSH_KEYS VOLUME_SIZES = [ "40" ] VOL_PROFILE = "10iops-tier" - SAP_SID = var.sap_sid + SAP_SID = var.SAP_SID for_each ={ - "sapapp-1" = {APP-HOSTNAME = "${var.APP-HOSTNAME-1}" , APP-HOSTNAME-DEFAULT = "sapapp-${var.sap_sid}-1"} - "sapapp-2" = {APP-HOSTNAME = "${var.APP-HOSTNAME-2}" , APP-HOSTNAME-DEFAULT = "sapapp-${var.sap_sid}-2"} + "sapapp-1" = { APP-HOSTNAME = lower("${var.APP_HOSTNAME_1}") , APP-HOSTNAME-DEFAULT = lower("sapapp-${var.SAP_SID}-1"), APP_REAL_HOSTNAME = lower("${var.APP_HOSTNAME_1}") != "sapapp-1" ? lower("${var.APP_HOSTNAME_1}") : lower("sapapp-${var.SAP_SID}-1") } + "sapapp-2" = { APP-HOSTNAME = lower("${var.APP_HOSTNAME_2}") , APP-HOSTNAME-DEFAULT = lower("sapapp-${var.SAP_SID}-2"), APP_REAL_HOSTNAME = lower("${var.APP_HOSTNAME_2}") != "sapapp-2" ? lower("${var.APP_HOSTNAME_2}") : lower("sapapp-${var.SAP_SID}-2") } } APP-HOSTNAME = "${each.value.APP-HOSTNAME}" INPUT-DEFAULT-HOSTNAME = "${each.key}" FINAL-DEFAULT-HOSTNAME = lower ("${each.value.APP-HOSTNAME-DEFAULT}") + REAL_HOSTNAME = "${each.value.APP_REAL_HOSTNAME}" } module "file-shares" { - depends_on = [ module.vpc-subnet , module.pg ] + depends_on = [ module.vpc-subnet, module.pg ] source = "./modules/file-shares" for_each = { - "usrsap-as1" = {size = var.usrsap-as1 , var_name = "as1", var_timeout = "1m" } - "usrsap-as2" = {size = var.usrsap-as2 , var_name = "as2" , var_timeout = "2m"} - "usrsap-sapascs" = {size = var.usrsap-sapascs , var_name = "sapascs", var_timeout = "3m" } - "usrsap-sapers" = {size = var.usrsap-sapers , var_name = "sapers", var_timeout = "4m" } - "usrsap-sapmnt" = {size = var.usrsap-sapmnt , var_name = "sapmnt", var_timeout = "5m" } - "usrsap-sapsys" = {size = var.usrsap-sapsys , var_name = "sapsys", var_timeout = "6m" } - "usrsap-trans" = {size = var.usrsap-trans , var_name = "trans" , var_timeout = "7m" } + "usrsap-as1" = {size = var.USRSAP_AS1 , var_name = "as1" } + "usrsap-as2" = {size = var.USRSAP_AS2 , var_name = "as2" } + "usrsap-sapascs" = {size = var.USRSAP_SAPASCS , var_name = "sapascs" } + "usrsap-sapers" = {size = var.USRSAP_SAPERS , var_name = "sapers" } + "usrsap-sapmnt" = {size = var.USRSAP_SAPMNT , var_name = "sapmnt" } + "usrsap-sapsys" = {size = var.USRSAP_SAPSYS , var_name = "sapsys" } + "usrsap-trans" = {size = var.USRSAP_TRANS , var_name = "trans" } } - api_key = var.ibmcloud_api_key - resource_group_id = data.ibm_resource_group.group.id + api_key = var.IBMCLOUD_API_KEY + resource_group_id = data.ibm_resource_group.group.id zone = var.ZONE prefix = each.key ansible_var_name = each.value.var_name - var_timeout = each.value.var_timeout vpc_id = data.ibm_is_vpc.vpc.id vpc = var.VPC region = var.REGION share_size = each.value.size - share_profile = var.share_profile - sap_sid = var.sap_sid -} - -module "file-shares-cleaning-up" { - depends_on = [ module.file-shares ] - source = "./modules/file-shares/cleaning-up" - for_each = { - "usrsap-as1" = {size = var.usrsap-as1 , var_name = "as1", var_timeout = "1m" } - "usrsap-as2" = {size = var.usrsap-as2 , var_name = "as2" , var_timeout = "3m"} - "usrsap-sapascs" = {size = var.usrsap-sapascs , var_name = "sapascs", var_timeout = "5m" } - "usrsap-sapers" = {size = var.usrsap-sapers , var_name = "sapers", var_timeout = "7m" } - "usrsap-sapmnt" = {size = var.usrsap-sapmnt , var_name = "sapmnt", var_timeout = "9m" } - "usrsap-sapsys" = {size = var.usrsap-sapsys , var_name = "sapsys", var_timeout = "11m" } - "usrsap-trans" = {size = var.usrsap-trans , var_name = "trans" , var_timeout = "13m" } - } - api_key = var.ibmcloud_api_key - resource_group_id = data.ibm_resource_group.group.id - zone = var.ZONE - prefix = each.key - ansible_var_name = each.value.var_name - var_timeout = each.value.var_timeout - vpc_id = data.ibm_is_vpc.vpc.id - vpc = var.VPC - region = var.REGION - share_size = each.value.size - share_profile = var.share_profile - sap_sid = var.sap_sid + share_profile = var.SHARE_PROFILE + sap_sid = var.SAP_SID } module "alb-prereq" { - depends_on = [ module.file-shares-cleaning-up ] + depends_on = [ module.file-shares ] source = "./modules/alb/prereq" for_each ={ - "${local.SAP-ALB-ASCS}" = {syd = var.sap_sid, delay ="1m"} - "${local.SAP-ALB-ERS}" = {syd = var.sap_sid, delay ="3m"} - "${local.DB-ALB-HANA}" = {syd = var.hana_sid, delay ="5m"} + "${local.SAP-ALB-ASCS}" = {syd = var.SAP_SID, delay ="1m"} + "${local.SAP-ALB-ERS}" = {syd = var.SAP_SID, delay ="3m"} + "${local.DB-ALB-HANA}" = {syd = var.HANA_SID, delay ="5m"} } SAP_ALB_NAME = "${each.key}" @@ -133,26 +105,26 @@ module "alb-prereq" { SUBNET = var.SUBNET RESOURCE_GROUP = var.RESOURCE_GROUP SAP_SID = "${each.value.syd}" - HANA_SYSNO = var.hana_sysno - SAP_ASCS = var.sap_ascs_instance_number - SAP_ERSNO = var.sap_ers_instance_number + HANA_SYSNO = var.HANA_SYSNO + SAP_ASCS = var.SAP_ASCS_INSTANCE_NUMBER + SAP_ERSNO = var.SAP_ERS_INSTANCE_NUMBER } module "alb-ascs" { - depends_on = [ module.alb-prereq , module.app-vsi ] + depends_on = [ module.alb-prereq, module.app-vsi, module.db-vsi ] source = "./modules/alb" SAP_HEALTH_MONITOR_PORT_PREFIX = "36" - SAP_HEALTH_MONITOR_PORT_POSTFIX = "${var.sap_ascs_instance_number}" + SAP_HEALTH_MONITOR_PORT_POSTFIX = "${var.SAP_ASCS_INSTANCE_NUMBER}" for_each = { - "backend-1" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "32" , port_postfix = "${var.sap_ascs_instance_number}", port_apostfix = ""} - "backend-2" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "36" , port_postfix = "${var.sap_ascs_instance_number}", port_apostfix = ""} - "backend-3" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "39" , port_postfix = "${var.sap_ascs_instance_number}", port_apostfix = ""} - "backend-4" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "81" , port_postfix = "${var.sap_ascs_instance_number}", port_apostfix = ""} - "backend-5" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "5" , port_postfix = "${var.sap_ascs_instance_number}", port_apostfix = "13"} - "backend-6" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "5" , port_postfix = "${var.sap_ascs_instance_number}", port_apostfix = "14"} - "backend-7" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "5" , port_postfix = "${var.sap_ascs_instance_number}", port_apostfix = "16"} + "backend-1" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "32" , port_postfix = "${var.SAP_ASCS_INSTANCE_NUMBER}", port_apostfix = ""} + "backend-2" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "36" , port_postfix = "${var.SAP_ASCS_INSTANCE_NUMBER}", port_apostfix = ""} + "backend-3" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "39" , port_postfix = "${var.SAP_ASCS_INSTANCE_NUMBER}", port_apostfix = ""} + "backend-4" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "81" , port_postfix = "${var.SAP_ASCS_INSTANCE_NUMBER}", port_apostfix = ""} + "backend-5" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "5" , port_postfix = "${var.SAP_ASCS_INSTANCE_NUMBER}", port_apostfix = "13"} + "backend-6" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "5" , port_postfix = "${var.SAP_ASCS_INSTANCE_NUMBER}", port_apostfix = "14"} + "backend-7" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "5" , port_postfix = "${var.SAP_ASCS_INSTANCE_NUMBER}", port_apostfix = "16"} } SAP_ALB_NAME = "${each.value.sap_alb_name}" @@ -161,29 +133,29 @@ module "alb-ascs" { SECURITY_GROUP = var.SECURITY_GROUP SUBNET = var.SUBNET RESOURCE_GROUP = var.RESOURCE_GROUP - SAP_SID = var.sap_sid - HANA_SYSNO = var.hana_sysno - SAP_ASCS = var.sap_ascs_instance_number - SAP_ERSNO = var.sap_ers_instance_number + SAP_SID = var.SAP_SID + HANA_SYSNO = var.HANA_SYSNO + SAP_ASCS = var.SAP_ASCS_INSTANCE_NUMBER + SAP_ERSNO = var.SAP_ERS_INSTANCE_NUMBER SAP-PRIVATE-IP-VSI1 = "${data.ibm_is_instance.app-vsi-1.primary_network_interface[0].primary_ip[0].address}" SAP-PRIVATE-IP-VSI2 = "${data.ibm_is_instance.app-vsi-2.primary_network_interface[0].primary_ip[0].address}" - SAP_BACKEND_POOL_NAME = lower ("${each.value.backend-name}-${var.sap_sid}-${each.value.port_prefix}${var.sap_ascs_instance_number}${each.value.port_apostfix}") + SAP_BACKEND_POOL_NAME = lower ("${each.value.backend-name}-${var.SAP_SID}-${each.value.port_prefix}${var.SAP_ASCS_INSTANCE_NUMBER}${each.value.port_apostfix}") SAP_PORT_LB = "${each.value.port_prefix}${each.value.port_postfix}${each.value.port_apostfix}" } module "alb-ers" { - depends_on = [ module.alb-prereq ,module.app-vsi ] + depends_on = [ module.alb-prereq, module.app-vsi, module.db-vsi ] source = "./modules/alb" SAP_HEALTH_MONITOR_PORT_PREFIX = "32" - SAP_HEALTH_MONITOR_PORT_POSTFIX = "${var.sap_ers_instance_number}" + SAP_HEALTH_MONITOR_PORT_POSTFIX = "${var.SAP_ERS_INSTANCE_NUMBER}" for_each = { - "backend-1" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "32" , port_postfix = "${var.sap_ers_instance_number}", port_apostfix = ""} - "backend-2" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "33" , port_postfix = "${var.sap_ers_instance_number}", port_apostfix = ""} - "backend-3" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "5" , port_postfix = "${var.sap_ers_instance_number}", port_apostfix = "13"} - "backend-4" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "5" , port_postfix = "${var.sap_ers_instance_number}", port_apostfix = "14"} - "backend-5" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "5" , port_postfix = "${var.sap_ers_instance_number}", port_apostfix = "16"} + "backend-1" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "32" , port_postfix = "${var.SAP_ERS_INSTANCE_NUMBER}", port_apostfix = ""} + "backend-2" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "33" , port_postfix = "${var.SAP_ERS_INSTANCE_NUMBER}", port_apostfix = ""} + "backend-3" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "5" , port_postfix = "${var.SAP_ERS_INSTANCE_NUMBER}", port_apostfix = "13"} + "backend-4" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "5" , port_postfix = "${var.SAP_ERS_INSTANCE_NUMBER}", port_apostfix = "14"} + "backend-5" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "5" , port_postfix = "${var.SAP_ERS_INSTANCE_NUMBER}", port_apostfix = "16"} } SAP_ALB_NAME = "${each.value.sap_alb_name}" @@ -192,32 +164,32 @@ module "alb-ers" { SECURITY_GROUP = var.SECURITY_GROUP SUBNET = var.SUBNET RESOURCE_GROUP = var.RESOURCE_GROUP - SAP_SID = var.sap_sid - HANA_SYSNO = var.hana_sysno - SAP_ASCS = var.sap_ascs_instance_number - SAP_ERSNO = var.sap_ers_instance_number + SAP_SID = var.SAP_SID + HANA_SYSNO = var.HANA_SYSNO + SAP_ASCS = var.SAP_ASCS_INSTANCE_NUMBER + SAP_ERSNO = var.SAP_ERS_INSTANCE_NUMBER SAP-PRIVATE-IP-VSI1 = "${data.ibm_is_instance.app-vsi-1.primary_network_interface[0].primary_ip[0].address}" SAP-PRIVATE-IP-VSI2 = "${data.ibm_is_instance.app-vsi-2.primary_network_interface[0].primary_ip[0].address}" - SAP_BACKEND_POOL_NAME = lower ("${each.value.backend-name}-${var.sap_sid}-${each.value.port_prefix}${each.value.port_postfix}${each.value.port_apostfix}") + SAP_BACKEND_POOL_NAME = lower ("${each.value.backend-name}-${var.SAP_SID}-${each.value.port_prefix}${each.value.port_postfix}${each.value.port_apostfix}") SAP_PORT_LB = "${each.value.port_prefix}${each.value.port_postfix}${each.value.port_apostfix}" } module "alb-hana" { - depends_on = [ module.alb-prereq , module.db-vsi ] + depends_on = [ module.alb-prereq, module.app-vsi, module.db-vsi ] source = "./modules/alb" SAP_HEALTH_MONITOR_PORT_PREFIX = "3" - SAP_HEALTH_MONITOR_PORT_POSTFIX = "${var.hana_sysno}13" + SAP_HEALTH_MONITOR_PORT_POSTFIX = "${var.HANA_SYSNO}13" for_each = { - "backend-1" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.hana_sysno}", port_apostfix = "13"} - "backend-2" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.hana_sysno}", port_apostfix = "14"} - "backend-3" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.hana_sysno}", port_apostfix = "15"} - "backend-4" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.hana_sysno}", port_apostfix = "40"} - "backend-5" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.hana_sysno}", port_apostfix = "41"} - "backend-6" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.hana_sysno}", port_apostfix = "42"} - "backend-7" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "5" , port_postfix = "${var.hana_sysno}", port_apostfix = "13"} - "backend-8" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "5" , port_postfix = "${var.hana_sysno}", port_apostfix = "14"} + "backend-1" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.HANA_SYSNO}", port_apostfix = "13"} + "backend-2" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.HANA_SYSNO}", port_apostfix = "14"} + "backend-3" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.HANA_SYSNO}", port_apostfix = "15"} + "backend-4" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.HANA_SYSNO}", port_apostfix = "40"} + "backend-5" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.HANA_SYSNO}", port_apostfix = "41"} + "backend-6" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.HANA_SYSNO}", port_apostfix = "42"} + "backend-7" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "5" , port_postfix = "${var.HANA_SYSNO}", port_apostfix = "13"} + "backend-8" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "5" , port_postfix = "${var.HANA_SYSNO}", port_apostfix = "14"} } SAP_ALB_NAME = "${each.value.sap_alb_name}" @@ -226,36 +198,36 @@ module "alb-hana" { SECURITY_GROUP = var.SECURITY_GROUP SUBNET = var.SUBNET RESOURCE_GROUP = var.RESOURCE_GROUP - SAP_SID = var.hana_sid - HANA_SYSNO = var.hana_sysno - SAP_ASCS = var.sap_ascs_instance_number - SAP_ERSNO = var.sap_ers_instance_number + SAP_SID = var.HANA_SID + HANA_SYSNO = var.HANA_SYSNO + SAP_ASCS = var.SAP_ASCS_INSTANCE_NUMBER + SAP_ERSNO = var.SAP_ERS_INSTANCE_NUMBER SAP-PRIVATE-IP-VSI1 = "${data.ibm_is_instance.db-vsi-1.primary_network_interface[0].primary_ip[0].address}" SAP-PRIVATE-IP-VSI2 = "${data.ibm_is_instance.db-vsi-2.primary_network_interface[0].primary_ip[0].address}" - SAP_BACKEND_POOL_NAME = lower ("${each.value.backend-name}-${var.hana_sid}-${each.value.port_prefix}${each.value.port_postfix}${each.value.port_apostfix}") + SAP_BACKEND_POOL_NAME = lower ("${each.value.backend-name}-${var.HANA_SID}-${each.value.port_prefix}${each.value.port_postfix}${each.value.port_apostfix}") SAP_PORT_LB = "${each.value.port_prefix}${each.value.port_postfix}${each.value.port_apostfix}" } module "dns" { - depends_on = [ module.alb-hana , module.file-shares-cleaning-up ] + depends_on = [ module.alb-hana, module.alb-ascs, module.alb-ers ] source = "./modules/dns" ZONE = var.ZONE REGION = var.REGION VPC = var.VPC RESOURCE_GROUP = var.RESOURCE_GROUP - SAP_SID = var.sap_sid + SAP_SID = var.SAP_SID ALB_ASCS_HOSTNAME = "${data.ibm_is_lb.alb-ascs.hostname}" ALB_ERS_HOSTNAME = "${data.ibm_is_lb.alb-ers.hostname}" ALB_HANA_HOSTNAME = "${data.ibm_is_lb.alb-hana.hostname}" DOMAIN_NAME = var.DOMAIN_NAME - ASCS-VIRT-HOSTNAME = var.ASCS-VIRT-HOSTNAME != "sapascs" ? var.ASCS-VIRT-HOSTNAME : lower ("${local.ASCS-VIRT-HOSTNAME}") - ERS-VIRT-HOSTNAME = var.ERS-VIRT-HOSTNAME != "sapers" ? var.ERS-VIRT-HOSTNAME : lower ("${local.ERS-VIRT-HOSTNAME}") - HANA-VIRT-HOSTNAME = var.HANA-VIRT-HOSTNAME != "dbhana" ? var.HANA-VIRT-HOSTNAME : lower ("${local.HANA-VIRT-HOSTNAME}") + ASCS_VIRT_HOSTNAME = var.ASCS_VIRT_HOSTNAME != "sapascs" ? var.ASCS_VIRT_HOSTNAME : lower ("${local.ASCS_VIRT_HOSTNAME}") + ERS_VIRT_HOSTNAME = var.ERS_VIRT_HOSTNAME != "sapers" ? var.ERS_VIRT_HOSTNAME : lower ("${local.ERS_VIRT_HOSTNAME}") + HANA_VIRT_HOSTNAME = var.HANA_VIRT_HOSTNAME != "dbhana" ? var.HANA_VIRT_HOSTNAME : lower ("${local.HANA_VIRT_HOSTNAME}") } module "s4pasreq" { source = "./modules/ansible-exec" - depends_on = [ module.app-vsi, local_file.ha_ansible_infra-vars, local_file.app_ansible_saps4app-vars, local_file.db_ansible_saphana-vars, module.file-shares-cleaning-up , module.dns ] + depends_on = [ module.app-vsi, local_file.ha_ansible_infra-vars, local_file.app_ansible_saps4app-vars, local_file.db_ansible_saphana-vars, local_file.tf_ansible_hana_storage_generated_file, module.file-shares, module.dns ] IP1 = data.ibm_is_instance.app-vsi-1.primary_network_interface[0].primary_ip[0].address PLAYBOOK_PATH = "ansible/s4pasreq.yml" } @@ -368,6 +340,6 @@ module "s4aasinst" { module "sec-exec" { source = "./modules/sec-exec" depends_on = [ module.s4aasinst ] - sap_main_password = var.sap_main_password - hana_main_password = var.hana_main_password + sap_main_password = var.SAP_MAIN_PASSWORD + hana_main_password = var.HANA_MAIN_PASSWORD } diff --git a/cli/modules/alb/lb.tf b/cli/modules/alb/lb.tf index 990b42e..46cbcc9 100644 --- a/cli/modules/alb/lb.tf +++ b/cli/modules/alb/lb.tf @@ -116,7 +116,7 @@ resource "ibm_is_lb_listener" "sap-frontend" { protocol = "tcp" port = "${var.SAP_PORT_LB}" default_pool = ibm_is_lb_pool.sap-backend.pool_id - idle_connection_timeout = 50 + idle_connection_timeout = 300 } diff --git a/cli/modules/app-vsi/variables.tf b/cli/modules/app-vsi/variables.tf index 98d22e0..6aa1e0f 100644 --- a/cli/modules/app-vsi/variables.tf +++ b/cli/modules/app-vsi/variables.tf @@ -71,4 +71,9 @@ variable "INPUT-DEFAULT-HOSTNAME" { variable "FINAL-DEFAULT-HOSTNAME" { type = string description = "APP VSI Hostname" -} \ No newline at end of file +} + +variable "REAL_HOSTNAME" { + type = string + description = "APP VSI Real Hostname" +} diff --git a/cli/modules/app-vsi/volume.tf b/cli/modules/app-vsi/volume.tf index de34219..e9a26bb 100644 --- a/cli/modules/app-vsi/volume.tf +++ b/cli/modules/app-vsi/volume.tf @@ -1,7 +1,7 @@ resource "ibm_is_volume" "vol" { count = length( var.VOLUME_SIZES ) - name = "${var.FINAL-DEFAULT-HOSTNAME}-vol${count.index}" + name = "${var.REAL_HOSTNAME}-vol${count.index}" zone = var.ZONE resource_group = data.ibm_resource_group.group.id capacity = var.VOLUME_SIZES[count.index] diff --git a/cli/modules/db-vsi/output.tf b/cli/modules/db-vsi/output.tf new file mode 100644 index 0000000..fab0679 --- /dev/null +++ b/cli/modules/db-vsi/output.tf @@ -0,0 +1,3 @@ +output "STORAGE-LAYOUT" { + value = local.DISPLAY_CRT_STORAGE +} \ No newline at end of file diff --git a/cli/modules/db-vsi/variables.tf b/cli/modules/db-vsi/variables.tf index 4137c29..685b02a 100644 --- a/cli/modules/db-vsi/variables.tf +++ b/cli/modules/db-vsi/variables.tf @@ -30,7 +30,8 @@ variable "RESOURCE_GROUP" { variable "PROFILE" { type = string - description = "VSI Profile" + description = "DB VSI Profile" + default = "mx2-16x128" } variable "IMAGE" { @@ -43,16 +44,6 @@ variable "SSH_KEYS" { description = "List of SSH Keys to access the VSI" } -variable "VOLUME_SIZES" { - type = list(string) - description = "List of volume sizes in GB to be created" -} - -variable "VOL_PROFILE" { - type = string - description = "Volume profile" -} - variable "SAP_SID" { type = string description = "SAP SID" @@ -71,4 +62,27 @@ variable "INPUT-DEFAULT-HOSTNAME" { variable "FINAL-DEFAULT-HOSTNAME" { type = string description = "DB VSI Hostname" -} \ No newline at end of file +} + +variable "REAL_HOSTNAME" { + type = string + description = "DB VSI Real Hostname" +} + +locals { + HANA_PROCESSING_TYPE = "All" + # HANA_PROCESSING_TYPE with accepted values: "All", "OLAP", "OLTP" "SAP Business One"- if needed for future development + ALL_HANA_CERTIFIED_STORAGE = jsondecode(file("${path.root}/files/hana_volume_layout.json")) + HANA_PROCESSING_TYPE_JSON = replace(trimspace(lower(local.HANA_PROCESSING_TYPE)), " ", "_") + PROCESSING_TYPE_FOUND = local.HANA_PROCESSING_TYPE_JSON == "all" ? true : contains(keys(local.ALL_HANA_CERTIFIED_STORAGE["profiles"]["${var.PROFILE}"]["processing_type"]), local.HANA_PROCESSING_TYPE_JSON) + OS_FROM_IMAGE = replace(replace(trimspace(lower(var.IMAGE)), "ibm-", ""), "/-amd64-sap-hana-.*/", "") + ALL_OS_TYPES = [] + OS_FOR_ALL_PROCESSING_TYPES = local.PROCESSING_TYPE_FOUND == true ? flatten([ for k in keys(local.ALL_HANA_CERTIFIED_STORAGE["profiles"]["${var.PROFILE}"]["processing_type"]) : concat(local.ALL_OS_TYPES, local.ALL_HANA_CERTIFIED_STORAGE["profiles"]["${var.PROFILE}"]["processing_type"]["${k}"])]) : [] + OS_TYPE_FOUND = local.PROCESSING_TYPE_FOUND == true ? (local.HANA_PROCESSING_TYPE_JSON == "all" ? contains(local.OS_FOR_ALL_PROCESSING_TYPES, "${lower(local.OS_FROM_IMAGE)}") : contains(local.ALL_HANA_CERTIFIED_STORAGE["profiles"]["${var.PROFILE}"]["processing_type"]["${local.HANA_PROCESSING_TYPE_JSON}"], "${lower(local.OS_FROM_IMAGE)}")) : false + CURRENT_STORAGE_CERTIFIED = local.PROCESSING_TYPE_FOUND == true && local.OS_TYPE_FOUND == true ? local.ALL_HANA_CERTIFIED_STORAGE.profiles["${var.PROFILE}"]["storage"]: null + # Define VOLUMES_STRUCTURE tuple for preserving the order of the elements in hash (to make sure the order for the elements in VOLUME_SIZES and VOL_PROFILE is the same) + VOLUMES_STRUCTURE = local.PROCESSING_TYPE_FOUND == true && local.OS_TYPE_FOUND == true ? flatten([ for k, v in local.CURRENT_STORAGE_CERTIFIED : v ]) : null + VOLUME_SIZES = local.PROCESSING_TYPE_FOUND == true && local.OS_TYPE_FOUND == true ? flatten([ for k in range(length(local.VOLUMES_STRUCTURE)) : [ [for _ in range(local.VOLUMES_STRUCTURE[k]["disk_count"]) : local.VOLUMES_STRUCTURE[k]["disk_size"]]]]) : [] + VOL_PROFILE = local.PROCESSING_TYPE_FOUND == true && local.OS_TYPE_FOUND == true ? flatten([ for k in range(length(local.VOLUMES_STRUCTURE)) : [ [for _ in range(local.VOLUMES_STRUCTURE[k]["disk_count"]) : local.VOLUMES_STRUCTURE[k]["iops"]]]]) : [] + DISPLAY_CRT_STORAGE = local.PROCESSING_TYPE_FOUND == true && local.OS_TYPE_FOUND == true ? { for k, v in local.CURRENT_STORAGE_CERTIFIED : k => { for j, m in v : j => m if j != "lvm" && j != "fs_type" && j != "mount_point" }} : null +} diff --git a/cli/modules/db-vsi/volume.tf b/cli/modules/db-vsi/volume.tf index de34219..8897d57 100644 --- a/cli/modules/db-vsi/volume.tf +++ b/cli/modules/db-vsi/volume.tf @@ -1,9 +1,8 @@ resource "ibm_is_volume" "vol" { - -count = length( var.VOLUME_SIZES ) - name = "${var.FINAL-DEFAULT-HOSTNAME}-vol${count.index}" + count = length( local.VOLUME_SIZES ) > 0 && length( local.VOLUME_SIZES ) == length( local.VOL_PROFILE ) ? length( local.VOLUME_SIZES ) : 0 + name = "${var.REAL_HOSTNAME}-vol${count.index}" zone = var.ZONE resource_group = data.ibm_resource_group.group.id - capacity = var.VOLUME_SIZES[count.index] - profile = var.VOL_PROFILE -} \ No newline at end of file + capacity = local.VOLUME_SIZES[count.index] + profile = local.VOL_PROFILE[count.index] +} diff --git a/cli/modules/db-vsi/vsi.tf b/cli/modules/db-vsi/vsi.tf index 22b35d3..2696790 100644 --- a/cli/modules/db-vsi/vsi.tf +++ b/cli/modules/db-vsi/vsi.tf @@ -38,4 +38,11 @@ resource "ibm_is_instance" "vsi" { security_groups = [data.ibm_is_security_group.securitygroup.id] } volumes = ibm_is_volume.vol[*].id + lifecycle { + precondition { + condition = local.PROCESSING_TYPE_FOUND == true && local.OS_TYPE_FOUND == true + error_message = "The chosen storage PROFILE for HANA VSI \"${var.PROFILE}\" is not a certified storage profile for the selected OS IMAGE: \"${var.IMAGE}\". Please, chose the appropriate certified storage PROFILE for the HANA VSI from https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc . Make sure the selected PROFILE is certified for the selected OS type and for the proceesing type (SAP Business One, OLTP, OLAP)" + # error_message = "The chosen storage PROFILE for HANA VSI \"${var.PROFILE}\" is not a certified storage profile for processing type: \"${upper(local.HANA_PROCESSING_TYPE)}\" or for the selected OS IMAGE: \"${var.IMAGE}\". Please, chose the appropriate certified storage PROFILE for the HANA VSI from https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc . Make sure the selected PROFILE is certified for the selected OS type and for the proceesing type (SAP Business One, OLTP, OLAP)" + } + } } \ No newline at end of file diff --git a/cli/modules/dns/dns_integration.tf b/cli/modules/dns/dns_integration.tf index 857414b..31cb073 100644 --- a/cli/modules/dns/dns_integration.tf +++ b/cli/modules/dns/dns_integration.tf @@ -8,9 +8,9 @@ resource "local_file" "ha_ansible_dns-vars" { # DNS variables domain_name: "${var.DOMAIN_NAME}" -cname_ascs: "${var.ASCS-VIRT-HOSTNAME}" -cname_ers: "${var.ERS-VIRT-HOSTNAME}" -cname_hana: "${var.HANA-VIRT-HOSTNAME}" +cname_ascs: "${var.ASCS_VIRT_HOSTNAME}" +cname_ers: "${var.ERS_VIRT_HOSTNAME}" +cname_hana: "${var.HANA_VIRT_HOSTNAME}" ... DOC filename = "ansible/dns-vars.yml" diff --git a/cli/modules/dns/dns_svcs.tf b/cli/modules/dns/dns_svcs.tf index 8625ce5..dc60da9 100644 --- a/cli/modules/dns/dns_svcs.tf +++ b/cli/modules/dns/dns_svcs.tf @@ -17,7 +17,7 @@ resource "ibm_dns_resource_record" "cname-ascs" { instance_id = ibm_resource_instance.dns_inst.guid zone_id = ibm_dns_zone.ha_zone.zone_id type = "CNAME" - name = var.ASCS-VIRT-HOSTNAME + name = var.ASCS_VIRT_HOSTNAME rdata = "${var.ALB_ASCS_HOSTNAME}" ttl = 43200 } @@ -26,7 +26,7 @@ resource "ibm_dns_resource_record" "cname-ers" { instance_id = ibm_resource_instance.dns_inst.guid zone_id = ibm_dns_zone.ha_zone.zone_id type = "CNAME" - name = var.ERS-VIRT-HOSTNAME + name = var.ERS_VIRT_HOSTNAME rdata = "${var.ALB_ERS_HOSTNAME}" ttl = 43200 } @@ -35,7 +35,7 @@ resource "ibm_dns_resource_record" "cname-hana" { instance_id = ibm_resource_instance.dns_inst.guid zone_id = ibm_dns_zone.ha_zone.zone_id type = "CNAME" - name = var.HANA-VIRT-HOSTNAME + name = var.HANA_VIRT_HOSTNAME rdata = "${var.ALB_HANA_HOSTNAME}" ttl = 43200 } diff --git a/cli/modules/dns/variables.tf b/cli/modules/dns/variables.tf index 6c3e748..3e126aa 100644 --- a/cli/modules/dns/variables.tf +++ b/cli/modules/dns/variables.tf @@ -50,17 +50,17 @@ data "ibm_resource_group" "group" { name = var.RESOURCE_GROUP } -variable "ASCS-VIRT-HOSTNAME" { +variable "ASCS_VIRT_HOSTNAME" { type = string description = "Private SubDomain Name" } -variable "ERS-VIRT-HOSTNAME" { +variable "ERS_VIRT_HOSTNAME" { type = string description = "Private SubDomain Name" } -variable "HANA-VIRT-HOSTNAME" { +variable "HANA_VIRT_HOSTNAME" { type = string description = "Private SubDomain Name" } diff --git a/cli/modules/file-shares/cache/mount_path.tmpl b/cli/modules/file-shares/cache/mount_path.tmpl deleted file mode 100644 index 728d91d..0000000 --- a/cli/modules/file-shares/cache/mount_path.tmpl +++ /dev/null @@ -1 +0,0 @@ -fsf-fra0451b-byok-fz.adn.networklayer.com:/949845d1_2fec_41dc_acca_9deb0f5f7a5a diff --git a/cli/modules/file-shares/cleaning-up/delete_file_share.sh b/cli/modules/file-shares/cleaning-up/delete_file_share.sh deleted file mode 100644 index 6b3ba63..0000000 --- a/cli/modules/file-shares/cleaning-up/delete_file_share.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -########### - -echo 'Login to ibmcloud' -ibmcloud config --check-version=false -q --http-timeout 240 --color enable -ibmcloud login -r $region -g $resource_group_id --apikey $api_key -export oauth_token=$(ibmcloud iam oauth-tokens | awk '{print $4}') - -share_id=$(cat modules/file-shares/cleaning-up/share_id_$share_name.tmpl) - -curl -X DELETE "$vpc_api_endpoint/v1/shares/$share_id?version=2023-05-30&generation=2&maturity=beta" -H "Authorization: Bearer ${oauth_token}" \ No newline at end of file diff --git a/cli/modules/file-shares/cleaning-up/delete_file_shares_mounts.sh b/cli/modules/file-shares/cleaning-up/delete_file_shares_mounts.sh deleted file mode 100644 index 8c68bd2..0000000 --- a/cli/modules/file-shares/cleaning-up/delete_file_shares_mounts.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -########### - -echo 'Login to ibmcloud' -ibmcloud config --check-version=false -q --http-timeout 240 --color enable -ibmcloud login -r $region -g $resource_group_id --apikey $api_key -export oauth_token=$(ibmcloud iam oauth-tokens | awk '{print $4}') - -share_id=$(cat modules/file-shares/cleaning-up/share_id_$share_name.tmpl) -mount_id=$(cat modules/file-shares/cleaning-up/mount_id_$share_name.tmpl) -curl -X DELETE "$vpc_api_endpoint/v1/shares/$share_id/mount_targets/$mount_id?version=2023-05-30&generation=2&maturity=beta" -H "Authorization: Bearer ${oauth_token}" \ No newline at end of file diff --git a/cli/modules/file-shares/cleaning-up/fs_clean_up_operations.tf b/cli/modules/file-shares/cleaning-up/fs_clean_up_operations.tf deleted file mode 100644 index 9d11d48..0000000 --- a/cli/modules/file-shares/cleaning-up/fs_clean_up_operations.tf +++ /dev/null @@ -1,88 +0,0 @@ -########################### File Share Creation -################################################## - -resource "null_resource" "get_fs_ids" { - depends_on = [ null_resource.delete_file_shares_mounts ] - triggers = { - vpc_api_endpoint = local.vpc_api_endpoint - api_key = var.api_key - share_name = lower ("${var.prefix}-${var.sap_sid}") - region = var.region - share_size = var.share_size - share_profile = var.share_profile - var_timeout = var.var_timeout - zone = var.zone - resource_group_id = var.resource_group_id - } - - provisioner "local-exec" { - when = destroy - - command = "sleep ${self.triggers.var_timeout};export resource_group_id=${self.triggers.resource_group_id};export share_profile=${self.triggers.share_profile};export share_size=${self.triggers.share_size};export zone=${self.triggers.zone};export vpc_api_endpoint=${self.triggers.vpc_api_endpoint};export api_key=${self.triggers.api_key};export share_name=${self.triggers.share_name}; export region=${self.triggers.region}; chmod +x ${path.module}/get_fs_ids.sh;${path.module}/get_fs_ids.sh > ${path.module}/get_ids.log" - interpreter = ["/bin/bash", "-c"] - on_failure = continue - } - -} - -resource "null_resource" "delete_file_shares_mounts" { - depends_on = [ null_resource.delete_file_share ] - #count = 1 - triggers = { - vpc_api_endpoint = local.vpc_api_endpoint - api_key = var.api_key - share_name = lower ("${var.prefix}-${var.sap_sid}") - region = var.region - zone = var.zone - share_size = var.share_size - share_profile = var.share_profile - resource_group_id = var.resource_group_id - } - - provisioner "local-exec" { - when = destroy - - command = "export resource_group_id=${self.triggers.resource_group_id};export share_profile=${self.triggers.share_profile};export share_size=${self.triggers.share_size};export zone=${self.triggers.zone};export vpc_api_endpoint=${self.triggers.vpc_api_endpoint};export api_key=${self.triggers.api_key};export share_name=${self.triggers.share_name}; export region=${self.triggers.region};chmod +x ${path.module}/get_fs_ids.sh;${path.module}/get_fs_ids.sh ;chmod +x ${path.module}/delete_file_shares_mounts.sh; ${path.module}/delete_file_shares_mounts.sh > ${path.module}/dmfs.log" - interpreter = ["/bin/bash", "-c"] - } -} - -resource "null_resource" "delete_file_share" { - depends_on = [ null_resource.troubleshoot_fs_ids ] - #count = 1 - triggers = { - vpc_api_endpoint = local.vpc_api_endpoint - api_key = var.api_key - share_name = lower ("${var.prefix}-${var.sap_sid}") - region = var.region - resource_group_id = var.resource_group_id - } - - provisioner "local-exec" { - when = destroy - - command = "export resource_group_id=${self.triggers.resource_group_id};export vpc_api_endpoint=${self.triggers.vpc_api_endpoint};export api_key=${self.triggers.api_key};export share_name=${self.triggers.share_name}; export region=${self.triggers.region};chmod +x ${path.module}/delete_file_share.sh; ${path.module}/delete_file_share.sh > ${path.module}/dfs.log" - interpreter = ["/bin/bash", "-c"] - } -} - -resource "null_resource" "troubleshoot_fs_ids" { - triggers = { - vpc_api_endpoint = local.vpc_api_endpoint - api_key = var.api_key - share_name = lower ("${var.prefix}-${var.sap_sid}") - region = var.region - share_size = var.share_size - share_profile = var.share_profile - var_timeout = var.var_timeout - zone = var.zone - } - - provisioner "local-exec" { - when = destroy - - command = "cat ${path.module}/*.log" - interpreter = ["/bin/bash", "-c"] - } - -} \ No newline at end of file diff --git a/cli/modules/file-shares/cleaning-up/get_fs_ids.sh b/cli/modules/file-shares/cleaning-up/get_fs_ids.sh deleted file mode 100644 index c6b4e0b..0000000 --- a/cli/modules/file-shares/cleaning-up/get_fs_ids.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -########### - -echo 'Login to ibmcloud' -ibmcloud config --check-version=false -q --http-timeout 240 --color enable -ibmcloud login -r $region -g $resource_group_id --apikey $api_key -export oauth_token=$(ibmcloud iam oauth-tokens | awk '{print $4}') - -export share_id=$(ibmcloud is share "$share_name" | awk '/ID/ {print $2}' | head -n 1) - -echo $share_id > modules/file-shares/cleaning-up/share_id_$share_name.tmpl - - -curl -X GET "$vpc_api_endpoint/v1/shares/$share_id/mount_targets?version=2023-05-30&generation=2&maturity=beta" \ - -H "Authorization: Bearer ${oauth_token}" \ - -H 'Content-Type: application/json' \ - -d '{ - "name": "'"$share_name"'", - "vpc": { - "id": "'"$vpc_id"'" - } - }' -o modules/file-shares/cleaning-up/output_fs_mt_$share_name.json - -export mount_id=$(grep -m 1 -o '"id":"[^"]*"' modules/file-shares/cleaning-up/output_fs_mt_$share_name.json | sed -n '1s/"id":"\(.*\)"/\1/p;q') -echo $mount_id > modules/file-shares/cleaning-up/mount_id_$share_name.tmpl diff --git a/cli/modules/file-shares/cleaning-up/variables.tf b/cli/modules/file-shares/cleaning-up/variables.tf deleted file mode 100644 index 04ee138..0000000 --- a/cli/modules/file-shares/cleaning-up/variables.tf +++ /dev/null @@ -1,78 +0,0 @@ -/** -################################################################################################################# -* Variable Section for the Bastion Module. -* Start Here of the Variable Section -################################################################################################################# -*/ -variable "vpc_id" { - description = "Required parameter vpc_id" - type = string -} - -variable "vpc" { - description = "Required parameter vpc" - type = string -} - -variable "region" { - description = "Please enter a region from the following available region and zones mapping." - type = string - } - -variable "zone" { - description = "Availability Zone where bastion resource will be created" - type = string -} - -variable "resource_group_id" { - description = "Resource Group ID is used to separate the resources in a group." - type = string -} - -/* -data "local_file" "input" { - depends_on = [ null_resource.create_file_share ] - filename = "${path.module}/cache/mount_path.tmpl" -} -*/ - -locals { - share_name = lower ("${var.prefix}-${var.sap_sid}") - vpc_api_endpoint = "https://${var.region}.iaas.cloud.ibm.com" -# mount_path = chomp(data.local_file.input.content) -} - -variable "sap_sid" { - type = string - description = "SAP SID" -} - -variable "api_key" { - description = "Please enter the IBM Cloud API key." - type = string -} - -variable "prefix" { - description = "Prefix for all the resources." - type = string -} - -variable "ansible_var_name" { - description = "ansible_var_name for all the resources." - type = string -} - -variable "var_timeout" { - description = "ansible_var_name for all the resources." - type = string -} - -variable "share_size" { - description = "Specify the file share size. The value should be between 10 GB to 32000 GB's" - type = number -} - -variable "share_profile" { - description = "Enter the share profile value. The value should be tier-3iops, tier-5iops and tier-10iops" - type = string -} diff --git a/cli/modules/file-shares/cleaning-up/versions.tf b/cli/modules/file-shares/cleaning-up/versions.tf deleted file mode 100644 index 80a8bb9..0000000 --- a/cli/modules/file-shares/cleaning-up/versions.tf +++ /dev/null @@ -1,19 +0,0 @@ -/** -################################################################################################################# -* Terraform Initialization for this Module and Version Specification -* Start of the Terraform Initialization Section -################################################################################################################# -**/ -terraform { - required_providers { - ibm = { - source = "IBM-Cloud/ibm" - } - } -} - -/** -################################################################################################################# -* End of the Terraform Initialization Section -################################################################################################################# -**/ diff --git a/cli/modules/file-shares/create_file_share.sh b/cli/modules/file-shares/create_file_share.sh deleted file mode 100644 index df2c9f3..0000000 --- a/cli/modules/file-shares/create_file_share.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -########### -echo 'Login to ibmcloud' -ibmcloud config --check-version=false -q --http-timeout 240 --color enable -ibmcloud login -r $region -g $resource_group_id --apikey $api_key -export oauth_token=$(ibmcloud iam oauth-tokens | awk '{print $4}') - -curl -X POST "$vpc_api_endpoint/v1/shares?version=2023-05-30&generation=2&maturity=beta" \ - -H "Authorization: Bearer ${oauth_token}" \ - -H "Content-Type: application/json" \ - -d '{ - "size": '$share_size', - "name": "'"$share_name"'", - "profile": { - "name": "'"$share_profile"'" - }, - "zone": { - "name": "'"$zone"'" - }, - "resource_group": { - "id": "'"$resource_group_id"'" - } - }' -o modules/file-shares/cache/output_fs_$share_name.json - -share_id=$(grep -o "\"id\":\"[^\"]*\"" modules/file-shares/cache/output_fs_$share_name.json | sed 's/"id":"//' | awk -F\" 'NR==1 {print $1}') - -echo $share_id > modules/file-shares/cache/share_id_$share_name.tmpl - -sleep 40 - -curl -X POST "$vpc_api_endpoint/v1/shares/$share_id/mount_targets?version=2023-05-30&generation=2&maturity=beta" \ - -H "Authorization: Bearer ${oauth_token}" \ - -H 'Content-Type: application/json' \ - -d '{ - "name": "'"$share_name"'", - "vpc": { - "id": "'"$vpc_id"'" - } - }' -o modules/file-shares/cache/output_fs_mt_$share_name.json - -sleep 20 - -mount_path=$(grep -o '"mount_path":"[^"]*"' modules/file-shares/cache/output_fs_mt_$share_name.json | awk -F'"' '{print $4}') -echo $mount_path > modules/file-shares/cache/mount_path.tmpl - - -mount_id=$(grep -m 1 -o '"id":"[^"]*"' modules/file-shares/cache/output_fs_mt_$share_name.json | sed -n '1s/"id":"\(.*\)"/\1/p;q') -echo $mount_id > modules/file-shares/cache/mount_id_$share_name.tmpl \ No newline at end of file diff --git a/cli/modules/file-shares/fs_operations.tf b/cli/modules/file-shares/fs_operations.tf index 3048933..0ba57f8 100644 --- a/cli/modules/file-shares/fs_operations.tf +++ b/cli/modules/file-shares/fs_operations.tf @@ -1,14 +1,23 @@ ########################### File Share Creation ################################################## -resource "time_sleep" "wait_for_FS_api" { - create_duration = var.var_timeout +resource "ibm_is_share" "sap_fs" { + access_control_mode = "vpc" + zone = var.zone + resource_group = var.resource_group_id + size = var.share_size + name = local.share_name + profile = var.share_profile } -resource "null_resource" "create_file_share" { - depends_on = [ time_sleep.wait_for_FS_api ] - provisioner "local-exec" { - command = "export resource_group_id=${var.resource_group_id };export vpc_api_endpoint=${local.vpc_api_endpoint}; export vpc_id=${var.vpc_id};export region=${var.region};export api_key=${var.api_key};export share_size=${var.share_size};export share_name=${local.share_name};export share_profile=${var.share_profile};export zone=${var.zone}; chmod +x ${path.module}/create_file_share.sh; ${path.module}/create_file_share.sh > ${path.module}/cfs.log" - interpreter = ["/bin/bash", "-c"] - } +resource "ibm_is_share_mount_target" "mount_target_sap_fs" { + share = ibm_is_share.sap_fs.id + vpc = var.vpc_id + name = local.share_name +} + +data "ibm_is_share_mount_target" "data_mount_target_sap_fs" { + depends_on = [ ibm_is_share_mount_target.mount_target_sap_fs ] + share = ibm_is_share.sap_fs.id + mount_target = ibm_is_share_mount_target.mount_target_sap_fs.mount_target } \ No newline at end of file diff --git a/cli/modules/file-shares/output.tf b/cli/modules/file-shares/output.tf index 8afa41e..3fca912 100644 --- a/cli/modules/file-shares/output.tf +++ b/cli/modules/file-shares/output.tf @@ -6,10 +6,11 @@ ## Creating ansible file share vars. resource "local_file" "file_share-vars" { - depends_on = [ null_resource.create_file_share ] + depends_on = [ data.ibm_is_share_mount_target.data_mount_target_sap_fs ] + file_permission = "0644" content = <<-DOC ${var.ansible_var_name}_share_name: "${local.share_name}" - ${var.ansible_var_name}_mount_path: "${local.mount_path}" + ${var.ansible_var_name}_mount_path: "${data.ibm_is_share_mount_target.data_mount_target_sap_fs.mount_path}" DOC filename = "ansible/fileshare_${local.share_name}.yml" } \ No newline at end of file diff --git a/cli/modules/file-shares/variables.tf b/cli/modules/file-shares/variables.tf index 3082935..461d310 100644 --- a/cli/modules/file-shares/variables.tf +++ b/cli/modules/file-shares/variables.tf @@ -29,15 +29,8 @@ variable "resource_group_id" { type = string } -data "local_file" "input" { - depends_on = [ null_resource.create_file_share ] - filename = "${path.module}/cache/mount_path.tmpl" -} - locals { share_name = lower ("${var.prefix}-${var.sap_sid}") - vpc_api_endpoint = "https://${var.region}.iaas.cloud.ibm.com" - mount_path = chomp(data.local_file.input.content) } variable "sap_sid" { @@ -60,17 +53,12 @@ variable "ansible_var_name" { type = string } -variable "var_timeout" { - description = "ansible_var_name for all the resources." - type = string -} - variable "share_size" { description = "Specify the file share size. The value should be between 10 GB to 32000 GB's" type = number } variable "share_profile" { - description = "Enter the share profile value. The value should be tier-3iops, tier-5iops and tier-10iops" + description = "The profile for File Share Storage. Valid value: dp2." type = string -} +} \ No newline at end of file diff --git a/cli/modules/sec-exec/sec-exec.tf b/cli/modules/sec-exec/sec-exec.tf index 7197d8d..fc22563 100644 --- a/cli/modules/sec-exec/sec-exec.tf +++ b/cli/modules/sec-exec/sec-exec.tf @@ -7,6 +7,6 @@ resource "null_resource" "sec-exec" { command = "sed -i 's/${var.hana_main_password}/xxxxxxxx/' terraform.tfstate" } provisioner "local-exec" { - command = "sleep 20; rm -rf ansible/*-vars.yml" + command = "sleep 20; rm -rf ansible/*-vars.yml; rm -f ansible/hana_volume_layout.json" } } diff --git a/cli/output.tf b/cli/output.tf index 4fd550e..e156091 100644 --- a/cli/output.tf +++ b/cli/output.tf @@ -6,6 +6,12 @@ output "HANA-DB-PRIVATE-IP-VSI2" { value = "${data.ibm_is_instance.db-vsi-2.primary_network_interface[0].primary_ip[0].address}" } +output "HANA-STORAGE-LAYOUT" { + value = distinct([ + for stg in module.db-vsi : stg.STORAGE-LAYOUT + ])[0] +} + output "SAP-APP-PRIVATE-IP-VSI1" { value = "${data.ibm_is_instance.app-vsi-1.primary_network_interface[0].primary_ip[0].address}" } diff --git a/cli/provider.tf b/cli/provider.tf index 44e93a6..77dfc34 100644 --- a/cli/provider.tf +++ b/cli/provider.tf @@ -1,13 +1,13 @@ -variable "ibmcloud_api_key" { +variable "IBMCLOUD_API_KEY" { description = "IBM Cloud API key" sensitive = true validation { - condition = length(var.ibmcloud_api_key) > 43 #&& substr(var.ibmcloud_api_key, 14, 15) == "-" - error_message = "The ibmcloud_api_key value must be a valid IBM Cloud API key." + condition = length(var.IBMCLOUD_API_KEY) > 43 #&& substr(var.IBMCLOUD_API_KEY, 14, 15) == "-" + error_message = "The IBMCLOUD_API_KEY value must be a valid IBM Cloud API key." } } provider "ibm" { - ibmcloud_api_key = var.ibmcloud_api_key + ibmcloud_api_key = var.IBMCLOUD_API_KEY region = var.REGION } diff --git a/cli/variables_fs.tf b/cli/variables_fs.tf index 47de046..e5cb0c4 100644 --- a/cli/variables_fs.tf +++ b/cli/variables_fs.tf @@ -10,56 +10,50 @@ data "ibm_resource_group" "group" { name = var.RESOURCE_GROUP } -variable "usrsap-as1" { - description = "Resource usrsap-as1" +variable "USRSAP_AS1" { + description = "Resource USRSAP-AS1" type = number default = 20 } -variable "usrsap-as2" { - description = "Resource usrsap-as2" +variable "USRSAP_AS2" { + description = "Resource USRSAP-AS2" type = number default = 20 } -variable "usrsap-sapascs" { - description = "Resource usrsap-sapascs" +variable "USRSAP_SAPASCS" { + description = "Resource USRSAP-SAPASCS" type = number default = 20 } -variable "usrsap-sapers" { - description = "Resource usrsap-sapers" +variable "USRSAP_SAPERS" { + description = "Resource USRSAP-SAPERS" type = number default = 20 } -variable "usrsap-sapmnt" { - description = "Resource usrsap-sapmnt" +variable "USRSAP_SAPMNT" { + description = "Resource USRSAP-SAPMNT" type = number default = 20 } -variable "usrsap-sapsys" { - description = "Resource usrsap-sapsys" +variable "USRSAP_SAPSYS" { + description = "Resource USRSAP-SAPSYS" type = number default = 20 } -variable "usrsap-trans" { - description = "Resource usrsap-trans" +variable "USRSAP_TRANS" { + description = "Resource USRSAP-TRANS" type = number default = 80 } -variable "share_size" { - description = "File Share storage size in GB. Value should be in between 10 and 32000." - type = number - default = 20 -} - -variable "share_profile" { - description = "Enter the IOPs (IOPS per GB) tier for File Share storage. Valid values are: dp2, tier-3iops, tier-5iops, tier-10iops." +variable "SHARE_PROFILE" { + description = "The File Share profile Storage." type = string - default = "tier-5iops" -} + default = "dp2" +} \ No newline at end of file diff --git a/cli/variables_infra.tf b/cli/variables_infra.tf index 7c94867..61667c0 100644 --- a/cli/variables_infra.tf +++ b/cli/variables_infra.tf @@ -32,54 +32,54 @@ variable "DOMAIN_NAME" { } locals { - ASCS-VIRT-HOSTNAME = "sap${var.sap_sid}ascs" - ERS-VIRT-HOSTNAME = "sap${var.sap_sid}ers" - HANA-VIRT-HOSTNAME = "db${var.hana_sid}hana" + ASCS_VIRT_HOSTNAME = "sap${var.SAP_SID}ascs" + ERS_VIRT_HOSTNAME = "sap${var.SAP_SID}ers" + HANA_VIRT_HOSTNAME = "db${var.HANA_SID}hana" } -variable "ASCS-VIRT-HOSTNAME" { +variable "ASCS_VIRT_HOSTNAME" { type = string description = "Private SubDomain Name" nullable = false default = "sapascs" validation { - condition = length(var.ASCS-VIRT-HOSTNAME) > 2 && length (regex("^[a-z]*||^[0-9]*", var.ASCS-VIRT-HOSTNAME)) > 0 && length (regexall("[\\&]|[\\%]|[\\!]|[\\@]|[\\#]|[\\*]|[\\^]", var.ASCS-VIRT-HOSTNAME)) == 0 + condition = length(var.ASCS_VIRT_HOSTNAME) > 2 && length (regex("^[a-z]*||^[0-9]*", var.ASCS_VIRT_HOSTNAME)) > 0 && length (regexall("[\\&]|[\\%]|[\\!]|[\\@]|[\\#]|[\\*]|[\\^]", var.ASCS_VIRT_HOSTNAME)) == 0 error_message = "The SUBDOMAIN_NAME variable should not be empty and no special chars are allowed." } } output VIRT-HOSTNAME-ASCS { - value = var.ASCS-VIRT-HOSTNAME != "sapascs" ? var.ASCS-VIRT-HOSTNAME : lower ("${local.ASCS-VIRT-HOSTNAME}") + value = var.ASCS_VIRT_HOSTNAME != "sapascs" ? var.ASCS_VIRT_HOSTNAME : lower ("${local.ASCS_VIRT_HOSTNAME}") } -variable "ERS-VIRT-HOSTNAME" { +variable "ERS_VIRT_HOSTNAME" { type = string description = "Private SubDomain Name" nullable = false default = "sapers" validation { - condition = length(var.ERS-VIRT-HOSTNAME) > 2 && length (regex("^[a-z]*||^[0-9]*", var.ERS-VIRT-HOSTNAME)) > 0 && length (regexall("[\\&]|[\\%]|[\\!]|[\\@]|[\\#]|[\\*]|[\\^]", var.ERS-VIRT-HOSTNAME)) == 0 + condition = length(var.ERS_VIRT_HOSTNAME) > 2 && length (regex("^[a-z]*||^[0-9]*", var.ERS_VIRT_HOSTNAME)) > 0 && length (regexall("[\\&]|[\\%]|[\\!]|[\\@]|[\\#]|[\\*]|[\\^]", var.ERS_VIRT_HOSTNAME)) == 0 error_message = "The SUBDOMAIN_NAME variable should not be empty and no special chars are allowed." } } output VIRT-HOSTNAME-ERS { - value = var.ERS-VIRT-HOSTNAME != "sapers" ? var.ERS-VIRT-HOSTNAME : lower ("${local.ERS-VIRT-HOSTNAME}") + value = var.ERS_VIRT_HOSTNAME != "sapers" ? var.ERS_VIRT_HOSTNAME : lower ("${local.ERS_VIRT_HOSTNAME}") } -variable "HANA-VIRT-HOSTNAME" { +variable "HANA_VIRT_HOSTNAME" { type = string description = "Private SubDomain Name" nullable = false default = "dbhana" validation { - condition = length(var.HANA-VIRT-HOSTNAME) > 2 && length (regex("^[a-z]*||^[0-9]*", var.HANA-VIRT-HOSTNAME)) > 0 && length (regexall("[\\&]|[\\%]|[\\!]|[\\@]|[\\#]|[\\*]|[\\^]", var.HANA-VIRT-HOSTNAME)) == 0 + condition = length(var.HANA_VIRT_HOSTNAME) > 2 && length (regex("^[a-z]*||^[0-9]*", var.HANA_VIRT_HOSTNAME)) > 0 && length (regexall("[\\&]|[\\%]|[\\!]|[\\@]|[\\#]|[\\*]|[\\^]", var.HANA_VIRT_HOSTNAME)) == 0 error_message = "The SUBDOMAIN_NAME variable should not be empty and no special chars are allowed." } } output VIRT-HOSTNAME-HANA { - value = var.HANA-VIRT-HOSTNAME != "dbhana" ? var.HANA-VIRT-HOSTNAME : lower ("${local.HANA-VIRT-HOSTNAME}") + value = var.HANA_VIRT_HOSTNAME != "dbhana" ? var.HANA_VIRT_HOSTNAME : lower ("${local.HANA_VIRT_HOSTNAME}") } @@ -126,93 +126,101 @@ variable "SSH_KEYS" { } locals { - DB-HOSTNAME-1 = "hanadb-${var.hana_sid}-1" - DB-HOSTNAME-2 = "hanadb-${var.hana_sid}-2" - APP-HOSTNAME-1 = "sapapp-${var.sap_sid}-1" - APP-HOSTNAME-2 = "sapapp-${var.sap_sid}-2" + DB_HOSTNAME_1 = "hanadb-${var.HANA_SID}-1" + DB_HOSTNAME_2 = "hanadb-${var.HANA_SID}-2" + APP_HOSTNAME_1 = "sapapp-${var.SAP_SID}-1" + APP_HOSTNAME_2 = "sapapp-${var.SAP_SID}-2" } -variable "DB-PROFILE" { +variable "DB_PROFILE" { type = string - description = "DB VSI Profile" + description = "DB VSI Profile. The certified profiles for SAP HANA in IBM VPC: https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc" default = "mx2-16x128" + validation { + condition = contains(keys(jsondecode(file("files/hana_volume_layout.json")).profiles), "${var.DB_PROFILE}") + error_message = "The chosen storage PROFILE for HANA VSI \"${var.DB_PROFILE}\" is not a certified storage profile. Please, chose the appropriate certified storage PROFILE for the HANA VSI from https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc . Make sure the selected PROFILE is certified for the selected OS type and for the proceesing type (SAP Business One, OLTP, OLAP)" + } } -variable "DB-IMAGE" { +variable "DB_IMAGE" { type = string description = "DB VSI OS Image" default = "ibm-redhat-8-6-amd64-sap-hana-2" + validation { + condition = length(regexall("^(ibm-redhat-8-6-amd64-sap-hana|ibm-redhat-8-4-amd64-sap-hana|ibm-sles-15-4-amd64-sap-hana|ibm-sles-15-3-amd64-sap-hana)-[0-9][0-9]*", var.DB_IMAGE)) > 0 + error_message = "The OS SAP DB_IMAGE must be one of \"ibm-sles-15-4-amd64-sap-hana-x\", \"ibm-sles-15-3-amd64-sap-hana-x\", \"ibm-redhat-8-6-amd64-sap-hana-x\" or \"ibm-redhat-8-4-amd64-sap-hana-x\"." + } } -variable "DB-HOSTNAME-1" { +variable "DB_HOSTNAME_1" { type = string description = "DB VSI Hostname-1" default = "hanadb-1" validation { - condition = length(var.DB-HOSTNAME-1) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.DB-HOSTNAME-1)) > 0 + condition = length(var.DB_HOSTNAME_1) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.DB_HOSTNAME_1)) > 0 error_message = "The DB-HOSTNAME is not valid." } } output HANA-DB-HOSTNAME-VSI1 { - value = var.DB-HOSTNAME-1 != "hanadb-1" ? var.DB-HOSTNAME-1 : lower ("${local.DB-HOSTNAME-1}") + value = var.DB_HOSTNAME_1 != "hanadb-1" ? var.DB_HOSTNAME_1 : lower ("${local.DB_HOSTNAME_1}") } -variable "DB-HOSTNAME-2" { +variable "DB_HOSTNAME_2" { type = string description = "DB VSI Hostname-2" default = "hanadb-2" nullable = true validation { - condition = length(var.DB-HOSTNAME-2) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.DB-HOSTNAME-2)) > 0 + condition = length(var.DB_HOSTNAME_2) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.DB_HOSTNAME_2)) > 0 error_message = "The DB-HOSTNAME is not valid." } } output HANA-DB-HOSTNAME-VSI2 { - value = var.DB-HOSTNAME-2 != "hanadb-2" ? var.DB-HOSTNAME-2 : lower ("${local.DB-HOSTNAME-2}") + value = var.DB_HOSTNAME_2 != "hanadb-2" ? var.DB_HOSTNAME_2 : lower ("${local.DB_HOSTNAME_2}") } -variable "APP-PROFILE" { +variable "APP_PROFILE" { type = string description = "VSI Profile" default = "bx2-4x16" } -variable "APP-IMAGE" { +variable "APP_IMAGE" { type = string description = "VSI OS Image" default = "ibm-redhat-8-6-amd64-sap-hana-2" } -variable "APP-HOSTNAME-1" { +variable "APP_HOSTNAME_1" { type = string description = "APP VSI Hostname-1" default = "sapapp-1" validation { - condition = length(var.APP-HOSTNAME-1) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.APP-HOSTNAME-1)) > 0 + condition = length(var.APP_HOSTNAME_1) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.APP_HOSTNAME_1)) > 0 error_message = "The APP-HOSTNAME is not valid." } } output SAP-APP-HOSTNAME-VSI1 { - value = var.APP-HOSTNAME-1 != "sapapp-1" ? var.APP-HOSTNAME-1 : lower ("${local.APP-HOSTNAME-1}") + value = var.APP_HOSTNAME_1 != "sapapp-1" ? var.APP_HOSTNAME_1 : lower ("${local.APP_HOSTNAME_1}") } -variable "APP-HOSTNAME-2" { +variable "APP_HOSTNAME_2" { type = string description = "DB VSI Hostname-2" default = "sapapp-2" nullable = true validation { - condition = length(var.APP-HOSTNAME-2) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.APP-HOSTNAME-2)) > 0 + condition = length(var.APP_HOSTNAME_2) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.APP_HOSTNAME_2)) > 0 error_message = "The APP-HOSTNAME is not valid." } } output SAP-APP-HOSTNAME-VSI2 { - value = var.APP-HOSTNAME-2 != "sapapp-2" ? var.APP-HOSTNAME-2 : lower ("${local.APP-HOSTNAME-2}") + value = var.APP_HOSTNAME_2 != "sapapp-2" ? var.APP_HOSTNAME_2 : lower ("${local.APP_HOSTNAME_2}") } locals { @@ -223,37 +231,37 @@ locals { data "ibm_is_lb" "alb-ascs" { depends_on = [module.alb-prereq] - name = lower ("${local.SAP-ALB-ASCS}-${var.sap_sid}") + name = lower ("${local.SAP-ALB-ASCS}-${var.SAP_SID}") } data "ibm_is_lb" "alb-ers" { depends_on = [module.alb-prereq] - name = lower ("${local.SAP-ALB-ERS}-${var.sap_sid}") + name = lower ("${local.SAP-ALB-ERS}-${var.SAP_SID}") } data "ibm_is_lb" "alb-hana" { depends_on = [module.alb-prereq] - name = lower ("${local.DB-ALB-HANA}-${var.hana_sid}") + name = lower ("${local.DB-ALB-HANA}-${var.HANA_SID}") } ### data "ibm_is_instance" "app-vsi-1" { depends_on = [module.app-vsi] - name = var.APP-HOSTNAME-1 != "sapapp-1" ? var.APP-HOSTNAME-1 : lower ("${local.APP-HOSTNAME-1}") + name = var.APP_HOSTNAME_1 != "sapapp-1" ? var.APP_HOSTNAME_1 : lower ("${local.APP_HOSTNAME_1}") } data "ibm_is_instance" "app-vsi-2" { depends_on = [module.app-vsi] - name = var.APP-HOSTNAME-2 != "sapapp-2" ? var.APP-HOSTNAME-2 : lower ("${local.APP-HOSTNAME-2}") + name = var.APP_HOSTNAME_2 != "sapapp-2" ? var.APP_HOSTNAME_2 : lower ("${local.APP_HOSTNAME_2}") } data "ibm_is_instance" "db-vsi-1" { depends_on = [module.db-vsi] - name = var.DB-HOSTNAME-1 != "hanadb-1" ? var.DB-HOSTNAME-1 : lower ("${local.DB-HOSTNAME-1}") + name = var.DB_HOSTNAME_1 != "hanadb-1" ? var.DB_HOSTNAME_1 : lower ("${local.DB_HOSTNAME_1}") } data "ibm_is_instance" "db-vsi-2" { depends_on = [module.db-vsi] - name = var.DB-HOSTNAME-2 != "hanadb-2" ? var.DB-HOSTNAME-2 : lower ("${local.DB-HOSTNAME-2}") + name = var.DB_HOSTNAME_2 != "hanadb-2" ? var.DB_HOSTNAME_2 : lower ("${local.DB_HOSTNAME_2}") } diff --git a/cli/variables_sap.tf b/cli/variables_sap.tf index 7cd02d5..39a88a6 100644 --- a/cli/variables_sap.tf +++ b/cli/variables_sap.tf @@ -2,192 +2,192 @@ # The variables and data sources used in SAP Ansible Modules. ############################################################## -variable "hana_sid" { +variable "HANA_SID" { type = string - description = "hana_sid" + description = "HANA_SID" default = "HDB" validation { - condition = length(regexall("^[a-zA-Z][a-zA-Z0-9][a-zA-Z0-9]$", var.hana_sid)) > 0 - error_message = "The hana_sid is not valid." + condition = length(regexall("^[a-zA-Z][a-zA-Z0-9][a-zA-Z0-9]$", var.HANA_SID)) > 0 + error_message = "The HANA_SID is not valid." } } -variable "sap_ascs_instance_number" { +variable "SAP_ASCS_INSTANCE_NUMBER" { type = string - description = "sap_ascs_instance_number" + description = "SAP_ASCS_INSTANCE_NUMBER" default = "00" validation { - condition = var.sap_ascs_instance_number >= 0 && var.sap_ascs_instance_number <=97 - error_message = "The sap_ascs_instance_number is not valid." + condition = var.SAP_ASCS_INSTANCE_NUMBER >= 0 && var.SAP_ASCS_INSTANCE_NUMBER <=97 + error_message = "The SAP_ASCS_INSTANCE_NUMBER is not valid." } } -variable "sap_ers_instance_number" { +variable "SAP_ERS_INSTANCE_NUMBER" { type = string - description = "sap_ers_instance_number" + description = "SAP_ERS_INSTANCE_NUMBER" default = "01" validation { - condition = var.sap_ers_instance_number >= 00 && var.sap_ers_instance_number <=99 - error_message = "The sap_ers_instance_number is not valid." + condition = var.SAP_ERS_INSTANCE_NUMBER >= 00 && var.SAP_ERS_INSTANCE_NUMBER <=99 + error_message = "The SAP_ERS_INSTANCE_NUMBER is not valid." } } -variable "sap_ci_instance_number" { +variable "SAP_CI_INSTANCE_NUMBER" { type = string - description = "sap_ci_instance_number" + description = "SAP_CI_INSTANCE_NUMBER" default = "10" validation { - condition = var.sap_ci_instance_number >= 00 && var.sap_ci_instance_number <=99 - error_message = "The sap_ci_instance_number is not valid." + condition = var.SAP_CI_INSTANCE_NUMBER >= 00 && var.SAP_CI_INSTANCE_NUMBER <=99 + error_message = "The SAP_CI_INSTANCE_NUMBER is not valid." } } -variable "sap_aas_instance_number" { +variable "SAP_AAS_INSTANCE_NUMBER" { type = string - description = "sap_aas_instance_number" + description = "SAP_AAS_INSTANCE_NUMBER" default = "20" validation { - condition = var.sap_aas_instance_number >= 00 && var.sap_aas_instance_number <=99 - error_message = "The sap_aas_instance_number is not valid." + condition = var.SAP_AAS_INSTANCE_NUMBER >= 00 && var.SAP_AAS_INSTANCE_NUMBER <=99 + error_message = "The SAP_AAS_INSTANCE_NUMBER is not valid." } } -variable "hana_sysno" { +variable "HANA_SYSNO" { type = string - description = "hana_sysno" + description = "HANA_SYSNO" default = "00" validation { - condition = var.hana_sysno >= 0 && var.hana_sysno <=97 - error_message = "The hana_sysno is not valid." + condition = var.HANA_SYSNO >= 0 && var.HANA_SYSNO <=97 + error_message = "The HANA_SYSNO is not valid." } } -variable "hana_main_password" { +variable "HANA_MAIN_PASSWORD" { type = string sensitive = true description = "HANADB main password" validation { - condition = length(regexall("^(.{0,7}|.{15,}|[^0-9a-zA-Z]*)$", var.hana_main_password)) == 0 && length(regexall("^[^0-9_][0-9a-zA-Z!@#$_]+$", var.hana_main_password)) > 0 - error_message = "The hana_main_password is not valid." + condition = length(regexall("^(.{0,7}|.{15,}|[^0-9a-zA-Z]*)$", var.HANA_MAIN_PASSWORD)) == 0 && length(regexall("^[^0-9_][0-9a-zA-Z!@#$_]+$", var.HANA_MAIN_PASSWORD)) > 0 + error_message = "The HANA_MAIN_PASSWORD is not valid." } } -variable "hana_system_usage" { +variable "HANA_SYSTEM_USAGE" { type = string - description = "hana_system_usage" + description = "HANA_SYSTEM_USAGE" default = "custom" validation { - condition = contains(["production", "test", "development", "custom" ], var.hana_system_usage ) - error_message = "The hana_system_usage must be one of: production, test, development, custom." + condition = contains(["production", "test", "development", "custom" ], var.HANA_SYSTEM_USAGE ) + error_message = "The HANA_SYSTEM_USAGE must be one of: production, test, development, custom." } } -variable "hana_components" { +variable "HANA_COMPONENTS" { type = string - description = "hana_components" + description = "HANA_COMPONENTS" default = "server" validation { - condition = contains(["all", "client", "es", "ets", "lcapps", "server", "smartda", "streaming", "rdsync", "xs", "studio", "afl", "sca", "sop", "eml", "rme", "rtl", "trp" ], var.hana_components ) - error_message = "The hana_components must be one of: all, client, es, ets, lcapps, server, smartda, streaming, rdsync, xs, studio, afl, sca, sop, eml, rme, rtl, trp." + condition = contains(["all", "client", "es", "ets", "lcapps", "server", "smartda", "streaming", "rdsync", "xs", "studio", "afl", "sca", "sop", "eml", "rme", "rtl", "trp" ], var.HANA_COMPONENTS ) + error_message = "The HANA_COMPONENTS must be one of: all, client, es, ets, lcapps, server, smartda, streaming, rdsync, xs, studio, afl, sca, sop, eml, rme, rtl, trp." } } -variable "kit_saphana_file" { +variable "KIT_SAPHANA_FILE" { type = string - description = "kit_saphana_file" - default = "51054623.ZIP" + description = "KIT_SAPHANA_FILE" + default = "51055299.ZIP" } -variable "sap_sid" { +variable "SAP_SID" { type = string - description = "sap_sid" + description = "SAP_SID" default = "S4A" validation { - condition = length(regexall("^[a-zA-Z][a-zA-Z0-9][a-zA-Z0-9]$", var.sap_sid)) > 0 - error_message = "The sap_sid is not valid." + condition = length(regexall("^[a-zA-Z][a-zA-Z0-9][a-zA-Z0-9]$", var.SAP_SID)) > 0 + error_message = "The SAP_SID is not valid." } } -variable "sap_main_password" { +variable "SAP_MAIN_PASSWORD" { type = string sensitive = true description = "SAP main password" validation { - condition = length(regexall("^(.{0,9}|.{15,}|[^0-9]*)$", var.sap_main_password)) == 0 && length(regexall("^[^0-9_][0-9a-zA-Z@#$_]+$", var.sap_main_password)) > 0 - error_message = "The sap_main_password is not valid." + condition = length(regexall("^(.{0,9}|.{15,}|[^0-9]*)$", var.SAP_MAIN_PASSWORD)) == 0 && length(regexall("^[^0-9_][0-9a-zA-Z@#$_]+$", var.SAP_MAIN_PASSWORD)) > 0 + error_message = "The SAP_MAIN_PASSWORD is not valid." } } -variable "ha_password" { +variable "HA_PASSWORD" { type = string sensitive = true description = "HA cluster password" validation { - condition = length(regexall("^(.{0,9}|.{15,}|[^0-9]*)$", var.ha_password)) == 0 && length(regexall("^[^0-9_][0-9a-zA-Z@#$_]+$", var.ha_password)) > 0 - error_message = "The ha_password is not valid." + condition = length(regexall("^(.{0,9}|.{15,}|[^0-9]*)$", var.HA_PASSWORD)) == 0 && length(regexall("^[^0-9_][0-9a-zA-Z@#$_]+$", var.HA_PASSWORD)) > 0 + error_message = "The HA_PASSWORD is not valid." } } -variable "hdb_concurrent_jobs" { +variable "HDB_CONCURRENT_JOBS" { type = string - description = "hdb_concurrent_jobs" + description = "HDB_CONCURRENT_JOBS" default = "23" validation { - condition = var.hdb_concurrent_jobs >= 1 && var.hdb_concurrent_jobs <=25 - error_message = "The hdb_concurrent_jobs is not valid." + condition = var.HDB_CONCURRENT_JOBS >= 1 && var.HDB_CONCURRENT_JOBS <=25 + error_message = "The HDB_CONCURRENT_JOBS is not valid." } } -variable "kit_sapcar_file" { +variable "KIT_SAPCAR_FILE" { type = string - description = "kit_sapcar_file" + description = "KIT_SAPCAR_FILE" default = "SAPCAR_1010-70006178.EXE" } -variable "kit_swpm_file" { +variable "KIT_SWPM_FILE" { type = string - description = "kit_swpm_file" + description = "KIT_SWPM_FILE" default = "SWPM20SP09_4-80003424.SAR" } -variable "kit_sapexe_file" { +variable "KIT_SAPEXE_FILE" { type = string - description = "kit_sapexe_file" + description = "KIT_SAPEXE_FILE" default = "SAPEXE_100-70005283.SAR" } -variable "kit_sapexedb_file" { +variable "KIT_SAPEXEDB_FILE" { type = string - description = "kit_sapexedb_file" + description = "KIT_SAPEXEDB_FILE" default = "SAPEXEDB_100-70005282.SAR" } -variable "kit_igsexe_file" { +variable "KIT_IGSEXE_FILE" { type = string - description = "kit_igsexe_file" + description = "KIT_IGSEXE_FILE" default = "igsexe_1-70005417.sar" } -variable "kit_igshelper_file" { +variable "KIT_IGSHELPER_FILE" { type = string - description = "kit_igshelper_file" + description = "KIT_IGSHELPER_FILE" default = "igshelper_17-10010245.sar" } -variable "kit_saphotagent_file" { +variable "KIT_SAPHOSTAGENT_FILE" { type = string - description = "kit_saphotagent_file" + description = "KIT_SAPHOSTAGENT_FILE" default = "SAPHOSTAGENT51_51-20009394.SAR" } -variable "kit_hdbclient_file" { +variable "KIT_HDBCLIENT_FILE" { type = string - description = "kit_hdbclient_file" + description = "KIT_HDBCLIENT_FILE" default = "IMDB_CLIENT20_009_28-80002082.SAR" } -variable "kit_s4hana_export" { +variable "KIT_S4HANA_EXPORT" { type = string - description = "kit_s4hana_export" + description = "KIT_S4HANA_EXPORT" default = "/S4HANA/export" } diff --git a/schematics/README.md b/schematics/README.md index 9755112..57232c9 100644 --- a/schematics/README.md +++ b/schematics/README.md @@ -35,8 +35,18 @@ SAP Software Provisioning Manager used for this solution is **2.0 SP13** and it' The VSIs are configured with Red Hat Enterprise Linux 8 for SAP HANA (amd64) and they have: at least two SSH keys configured to access as root user and the following storage volumes created for DB and SAP APP VSI: HANA DBs VSI Disks: -- 3 x 500 GB disks with 10 IOPS / GB - DATA -- 1 x 10 GB disk - SWAP +- the disk sizes depend on the selected profile, according to [Intel Virtual Server certified profiles on VPC infrastructure for SAP HANA](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc) - Last updated 2022-01-28 + +Note: LVM will be used for **`/hana/data`**, **`hana/log`**, **`/hana/shared`** and **`/usr/sap`**, for all storage profiles, excepting **`vx2d-44x616`** and **`vx2d-88x1232`** profiles, where **`/hana/data`** and **`/hana/shared`** won't be manged by LVM, according to [Intel Virtual Server certified profiles on VPC infrastructure for SAP HANA](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc#vx2d-16x224) - Last updated 2022-01-28 and to [Storage design considerations](https://cloud.ibm.com/docs/sap?topic=sap-storage-design-considerations#hana-iaas-mx2-16x128-32x256-configure) - Last updated 2022-05-19 + +For example, in case of deploying a HANA VM, using the default value for VSI profile `mx2-16x128`, the automation will execute the following storage setup: +- 3 volumes x 500 GB each for `_hana_vg` volume group + - the volume group will contain the following logical volumes (created with three stripes): + - `_hana_data_lv` - size 988 GB + - `_hana_log_lv` - size 256 GB + - `_hana_shared` - size 256 GB +- 1 volume x 50 GB for `/usr/sap` (volume group: `_usr_sap_vg`, logical volume: `_usr_sap_lv`) +- 1 volume x 10 GB for a 2 GB SWAP logical volume (volume group: `_swap_vg`, logical volume: `_swap_lv`) SAP APPs VSI Disks: - 1x 40 GB disk with 10 IOPS / GB - SWAP @@ -46,7 +56,7 @@ File Shares: - 1 x 80GB file shares -DATA ## IBM Cloud API Key -The IBM Cloud API Key should be provided as input value of type sensitive for "ibmcloud_api_key" variable, in `IBM Schematics -> Workspaces -> -> Settings` menu. +The IBM Cloud API Key should be provided as input value of type sensitive for "IBMCLOUD_API_KEY" variable, in `IBM Schematics -> Workspaces -> -> Settings` menu. The IBM Cloud API Key can be created [here](https://cloud.ibm.com/iam/apikeys). ## Input parameters @@ -56,8 +66,8 @@ The following parameters can be set in the Schematics workspace: VPC, Subnet, Se Parameter | Description ----------|------------ -ibmcloud_api_key | IBM Cloud API key (Sensitive* value). -private_ssh_key | id_rsa private key content (Sensitive* value). +IBMCLOUD_API_KEY | IBM Cloud API key (Sensitive* value). +PRIVATE_SSH_KEY | id_rsa private key content (Sensitive* value). SSH_KEYS | List of SSH Keys UUIDs that are allowed to SSH as root to the VSI. Can contain one or more IDs. The list of SSH Keys is available [here](https://cloud.ibm.com/vpc-ext/compute/sshKeys).
Sample input (use your own SSH UUIDs from IBM Cloud):
[ "r010-57bfc315-f9e5-46bf-bf61-d87a24a9ce7a" , "r010-3fcd9fe7-d4a7-41ce-8bb3-d96e936b2c7e" ] BASTION_FLOATING_IP | The FLOATING IP from the Bastion Server. RESOURCE_GROUP | The name of an EXISTING Resource Group for VSIs and Volumes resources.
Default value: "Default". The list of Resource Groups is available [here](https://cloud.ibm.com/account/resource-groups). @@ -67,45 +77,45 @@ VPC | The name of an EXISTING VPC. The list of VPCs is available [here](https:// SUBNET | The name of an EXISTING Subnet. The list of Subnets is available [here](https://cloud.ibm.com/vpc-ext/network/subnets). SECURITY_GROUP | The name of an EXISTING Security group. The list of Security Groups is available [here](https://cloud.ibm.com/vpc-ext/network/securityGroups). DOMAIN_NAME | The Domain Name used for DNS and ALB. Duplicates are not allowed. The list with DNS resources can be searched [here](https://cloud.ibm.com/resources).
Sample value: "example.com".
_(See Obs.*)_ -SHARE PROFILES | IOPS per GB tier for File Share storage. Valid values are 3, 5, and 10. For more info about file share profiles, check [here](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles).
Default value: share_profile = "tier-5iops". -SHARE SIZES | Custom File Shares Sizes for SAP mounts. Sample values: usrsap-sapmnt = "20" , usrsap-trans = "80". +SHARE PROFILES | IOPS per GB tier for File Share storage. Valid values are 3, 5, and 10. For more info about file share profiles, check [here](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles).
Default value: SHARE_PROFILE = "tier-5iops". +SHARE SIZES | Custom File Shares Sizes for SAP mounts. Sample values: USRSAP_SAPMNT = "20" , USRSAP_TRANS = "80". [DB/APP]-
VIRT-HOSTNAMES | ASCS/ERS/HANA virtual hostnames.
Default values: "sap($your_sap_sid)ascs/ers" , "sap($your_sap_sid)ers" , "db($your_hana_sid)hana". -[DB/APP]-HOSTNAMES | SAP HANA/APP Cluster VSI Hostnames. Each hostname should be up to 13 characters as required by SAP.
For more information on rules regarding hostnames for SAP systems, check [SAP Note 611361: Hostnames of SAP ABAP Platform servers](https://launchpad.support.sap.com/#/notes/%20611361).
Default values: APP-HOSTNAME-1/2 = "sapapp-$your_sap_sid-1/2" , DB-HOSTNAME-1/2 = "hanadb-$your_hana_sid-1/2". -[DB/APP]-PROFILES | The profile used for the HANA/APP VSI. A list of profiles is available [here](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles).
For more information about supported DB/OS and IBM Gen 2 Virtual Server Instances (VSI), check [SAP Note 2927211: SAP Applications on IBM Virtual Private Cloud](https://launchpad.support.sap.com/#/notes/2927211)
Default values: DB-PROFILE = "mx2-16x128" , APP-PROFILE = "bx2-4x16". +[DB/APP]-HOSTNAMES | SAP HANA/APP Cluster VSI Hostnames. Each hostname should be up to 13 characters as required by SAP.
For more information on rules regarding hostnames for SAP systems, check [SAP Note 611361: Hostnames of SAP ABAP Platform servers](https://launchpad.support.sap.com/#/notes/%20611361).
Default values: APP_HOSTNAME_1/2 = "sapapp-$your_sap_sid-1/2" , DB_HOSTNAME_1/2 = "hanadb-$your_hana_sid-1/2". +[DB/APP]-PROFILES | The profile used for the HANA/APP VSI. A list of profiles is available [here](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles).
For more information about supported DB/OS and IBM Gen 2 Virtual Server Instances (VSI), check [SAP Note 2927211: SAP Applications on IBM Virtual Private Cloud](https://launchpad.support.sap.com/#/notes/2927211)
Default values: DB_PROFILE = "mx2-16x128" , APP_PROFILE = "bx2-4x16". [DB/APP]-IMAGE | The OS image used for the HANA/APP VSI. You must use the Red Hat Enterprise Linux 8 for SAP HANA (amd64) image for all VMs as this image contains the required SAP and HA subscriptions. A list of images is available [here](https://cloud.ibm.com/docs/vpc?topic=vpc-about-images)
Default value: "ibm-redhat-8-6-amd64-sap-hana-2" **SAP input parameters:** Parameter | Description | Requirements ----------|-------------|------------- -hana_sid | The SAP system ID identifies the SAP HANA system.
_(See Obs.*)_ |
  • Consists of exactly three alphanumeric characters
  • Has a letter for the first character
  • Does not include any of the reserved IDs listed in SAP Note 1979280
| -hana_sysno | Specifies the instance number of the SAP HANA system|
  • Two-digit number from 00 to 97
  • Must be unique on a host
-hana_system_usage | System Usage | Default: custom
Valid values: production, test, development, custom -hana_components | SAP HANA Components | Default: server
Valid values: all, client, es, ets, lcapps, server, smartda, streaming, rdsync, xs, studio, afl, sca, sop, eml, rme, rtl, trp -kit_saphana_file | Path to SAP HANA ZIP file | As downloaded from SAP Support Portal.
Default value: "/storage/HANADB/51055299.ZIP" -sap_sid | The SAP system ID identifies the entire SAP system.
_(See Obs.*)_|
  • Consists of exactly three alphanumeric characters
  • Has a letter for the first character
  • Does not include any of the reserved IDs listed in SAP Note 1979280
-sap_ascs_instance_number | Technical identifier for internal processes of ASCS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
-sap_ers_instance_number | Technical identifier for internal processes of ERS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
-sap_ci_instance_number | Technical identifier for internal processes of PAS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
-sap_aas_instance_number | Technical identifier for internal processes of AAS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
-hdb_concurrent_jobs | Number of concurrent jobs used to load and/or extract archives to HANA Host | Default: 23 -kit_sapcar_file | Path to sapcar binary | As downloaded from SAP Support Portal.
Default value: "/storage/S4HANA/SAPCAR_1010-70006178.EXE" -kit_swpm_file | Path to SWPM archive (SAR) | As downloaded from SAP Support Portal.
Default value: "/storage/S4HANA/SWPM20SP13_1-80003424.SAR" -kit_sapexe_file | Path to SAP Kernel OS archive (SAR) | As downloaded from SAP Support Portal.
Default value: "/storage/S4HANA/SAPEXE_100-70005283.SAR" -kit_sapexedb_file | Path to SAP Kernel DB archive (SAR) | As downloaded from SAP Support Portal.
Default value: "/storage/S4HANA/SAPEXEDB_100-70005282.SAR" -kit_igsexe_file | Path to IGS archive (SAR) | As downloaded from SAP Support Portal.
Default value: "/storage/S4HANA/igsexe_1-70005417.sar" -kit_igshelper_file | Path to IGS Helper archive (SAR) | As downloaded from SAP Support Portal.
Default value: "/storage/S4HANA/igshelper_17-10010245.sar" +HANA_SID | The SAP system ID identifies the SAP HANA system.
_(See Obs.*)_ |
  • Consists of exactly three alphanumeric characters
  • Has a letter for the first character
  • Does not include any of the reserved IDs listed in SAP Note 1979280
| +HANA_SYSNO | Specifies the instance number of the SAP HANA system|
  • Two-digit number from 00 to 97
  • Must be unique on a host
+HANA_SYSTEM_USAGE | System Usage | Default: custom
Valid values: production, test, development, custom +HANA_COMPONENTS | SAP HANA Components | Default: server
Valid values: all, client, es, ets, lcapps, server, smartda, streaming, rdsync, xs, studio, afl, sca, sop, eml, rme, rtl, trp +KIT_SAPHANA_FILE | Path to SAP HANA ZIP file | As downloaded from SAP Support Portal.
Default value: "/storage/HANADB/51055299.ZIP" +SAP_SID | The SAP system ID identifies the entire SAP system.
_(See Obs.*)_|
  • Consists of exactly three alphanumeric characters
  • Has a letter for the first character
  • Does not include any of the reserved IDs listed in SAP Note 1979280
+SAP_ASCS_INSTANCE_NUMBER | Technical identifier for internal processes of ASCS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
+SAP_ERS_INSTANCE_NUMBER | Technical identifier for internal processes of ERS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
+SAP_CI_INSTANCE_NUMBER | Technical identifier for internal processes of PAS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
+SAP_AAS_INSTANCE_NUMBER | Technical identifier for internal processes of AAS|
  • Two-digit number from 00 to 97
  • Must be unique on a host
+HDB_CONCURRENT_JOBS | Number of concurrent jobs used to load and/or extract archives to HANA Host | Default: 23 +KIT_SAPCAR_FILE | Path to sapcar binary | As downloaded from SAP Support Portal.
Default value: "/storage/S4HANA/SAPCAR_1010-70006178.EXE" +KIT_SWPM_FILE | Path to SWPM archive (SAR) | As downloaded from SAP Support Portal.
Default value: "/storage/S4HANA/SWPM20SP13_1-80003424.SAR" +KIT_SAPEXE_FILE | Path to SAP Kernel OS archive (SAR) | As downloaded from SAP Support Portal.
Default value: "/storage/S4HANA/SAPEXE_100-70005283.SAR" +KIT_SAPEXEDB_FILE | Path to SAP Kernel DB archive (SAR) | As downloaded from SAP Support Portal.
Default value: "/storage/S4HANA/SAPEXEDB_100-70005282.SAR" +KIT_IGSEXE_FILE | Path to IGS archive (SAR) | As downloaded from SAP Support Portal.
Default value: "/storage/S4HANA/igsexe_1-70005417.sar" +KIT_IGSHELPER_FILE | Path to IGS Helper archive (SAR) | As downloaded from SAP Support Portal.
Default value: "/storage/S4HANA/igshelper_17-10010245.sar" kit_saphostagent_file | Path to SAP Host Agent archive (SAR) | As downloaded from SAP Support Portal.
Default value: "/storage/S4HANA/SAPHOSTAGENT51_51-20009394.SAR" -kit_hdbclient_file | Path to HANA DB client archive (SAR) | As downloaded from SAP Support Portal.
Default value: "/storage/S4HANA/IMDB_CLIENT20_009_28-80002082.SAR" -kit_s4hana_export | Path to S/4HANA Installation Export dir | The archives downloaded from SAP Support Portal should be present in this path.
Default value: "/storage/S4HANA/export" +KIT_HDBCLIENT_FILE | Path to HANA DB client archive (SAR) | As downloaded from SAP Support Portal.
Default value: "/storage/S4HANA/IMDB_CLIENT20_009_28-80002082.SAR" +KIT_S4HANA_EXPORT | Path to S/4HANA Installation Export dir | The archives downloaded from SAP Support Portal should be present in this path.
Default value: "/storage/S4HANA/export" **SAP Passwords:**
_(Sensitive* values)_ Parameter | Description | Requirements ----------|-------------|------------- -sap_main_password | Common password for all users that are created during the installation |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
-hana_main_password | HANA system master password |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
  • Master Password must contain at least one upper-case character
-ha_password | HA cluster password |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
+SAP_MAIN_PASSWORD | Common password for all users that are created during the installation |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
+HANA_MAIN_PASSWORD | HANA system master password |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)
  • Master Password must contain at least one upper-case character
+HA_PASSWORD | HA cluster password |
  • It must be 8 to 14 characters long
  • It must contain at least one digit (0-9)
  • It must not contain \ (backslash) and " (double quote)

diff --git a/schematics/ansible/roles/hdbclusterhooks/tasks/main.yml b/schematics/ansible/roles/hdbclusterhooks/tasks/main.yml index 77fc9b7..2d98227 100644 --- a/schematics/ansible/roles/hdbclusterhooks/tasks/main.yml +++ b/schematics/ansible/roles/hdbclusterhooks/tasks/main.yml @@ -16,6 +16,10 @@ group: sapsys mode: 0755 +- name: Pause for 15 minutes to allow all started processes to complete + ansible.builtin.pause: + minutes: 15 + - name: Stop HANADB instance shell: | /usr/sap/{{ hana_sid | upper }}/HDB{{ hana_sysno }}/HDB stop diff --git a/schematics/ansible/roles/s4appreq/tasks/configurations/hostname_fix_RedHat.yml b/schematics/ansible/roles/s4appreq/tasks/configurations/hostname_fix_RedHat.yml index 6e3dd62..3267f1f 100644 --- a/schematics/ansible/roles/s4appreq/tasks/configurations/hostname_fix_RedHat.yml +++ b/schematics/ansible/roles/s4appreq/tasks/configurations/hostname_fix_RedHat.yml @@ -16,4 +16,10 @@ path: /etc/hosts regexp: "^(?!{{ ansible_default_ipv4.address }}.*{{ sap_short_hostname.stdout }})(.*)({{ sap_short_hostname.stdout }}.*)" replace: '\1' + +- name: Disable ipv6 localhost + replace: + path: /etc/hosts + regexp: '^\:\:1(\s)' + replace: '# ::1 \1' ... diff --git a/schematics/ansible/roles/s4appreq/tasks/configurations/kernel_RedHat7.yml b/schematics/ansible/roles/s4appreq/tasks/configurations/kernel_RedHat7.yml deleted file mode 100644 index bc3cf49..0000000 --- a/schematics/ansible/roles/s4appreq/tasks/configurations/kernel_RedHat7.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: Set recommended kernel parameters for RedHat 7 - sysctl: - sysctl_file: /etc/sysctl.d/sap.conf - name: "{{ kernel_param.name }}" - value: "{{ kernel_param.value }}" - sysctl_set: yes - state: present - reload: yes - loop: - - { name: kernel.sem, value: "1250 256000 100 1024" } - - { name: vm.max_map_count, value: 2147483647 } #900929 - Linux: STORAGE_PARAMETERS_WRONG_SET and "mmap() failed" - loop_control: - loop_var: kernel_param -... \ No newline at end of file diff --git a/schematics/ansible/roles/s4appreq/tasks/configurations/update_RedHat7.yml b/schematics/ansible/roles/s4appreq/tasks/configurations/update_RedHat7.yml deleted file mode 100644 index da9a854..0000000 --- a/schematics/ansible/roles/s4appreq/tasks/configurations/update_RedHat7.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- name: Enable repository for compat-sap-c++-9 - rhsm_repository: - name: "{{ repo_name }}" - state: enabled - loop: - # - rhel-sap-for-rhel-7-server-e4s-rpms - - rhel-7-server-rpms - - rhel-sap-hana-for-rhel-7-server-rpms - - rhel-7-server-eus-rpms - - loop_control: - loop_var: repo_name - -- name: Update all packages # noqa 403 - yum: - name: '*' - state: latest -... diff --git a/schematics/ansible/roles/s4appreq/vars/RedHat7.yml b/schematics/ansible/roles/s4appreq/vars/RedHat7.yml deleted file mode 100644 index 4f6c4d0..0000000 --- a/schematics/ansible/roles/s4appreq/vars/RedHat7.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -s4app_required_packages: - - uuidd - - compat-libstdc++-33 - - compat-sap-c++-6 - - lvm2 - - tcsh - - ksh -s4app_required_package_groups: - - "@large-systems" - - "@network-file-system-client" - - "@performance" - - "@compat-libraries" -s4app_required_configurations: - - "repository_RedHat" - - "update_RedHat7" - - "reqpkg" - - "reqpkggroups_RedHat" - - "hostname_fix_RedHat" - - "firewalld" - - "uuidd" - - "SELinux" - - "limits" - - "tmpfiles" - - "compatlibs" - - "kernel_RedHat7" - - "reboot" -... diff --git a/schematics/ansible/roles/s4pasinst/tasks/main.yml b/schematics/ansible/roles/s4pasinst/tasks/main.yml index d285f55..a4f6f05 100644 --- a/schematics/ansible/roles/s4pasinst/tasks/main.yml +++ b/schematics/ansible/roles/s4pasinst/tasks/main.yml @@ -1,4 +1,8 @@ --- +- name: Pause for 10 minutes to make sure HANA is up + ansible.builtin.pause: + minutes: 10 + - name: Generate parameter file for sapinst template: src: pasconfig.cfg diff --git a/schematics/ansible/roles/saphanareq/filter_plugins/filesystemdata.py b/schematics/ansible/roles/saphanareq/filter_plugins/filesystemdata.py new file mode 100644 index 0000000..8e1d443 --- /dev/null +++ b/schematics/ansible/roles/saphanareq/filter_plugins/filesystemdata.py @@ -0,0 +1,64 @@ +#!/usr/bin/python + +class FilterModule(object): + '''Data related to filesystems for HANA VM''' + + def filters(self): + return { + 'filesystemdata': self.filesystemdata + } + + def filesystemdata(self, data_list): + final_list = [] + data_map = data_list[0] + sid = data_list[1] + for k, v in data_map.items(): + key_to_check = 'lvm' + if key_to_check in v: + for m in v['lvm']['lv']: + temp_list = [] + fs_device = "/dev/" + sid + "_" + v['lvm']['vg']['vg_name'] + "/" + sid + "_" + m['lv_name'] + mp = None + fs_options = "" + label = "" + mount_source = fs_device + if m['lv_name'] == 'hana_data_lv': + label = "HANA_DATA" + elif m['lv_name'] == 'hana_log_lv': + label = "HANA_LOG" + elif m['lv_name'] == 'hana_shared_lv': + label = "HANA_SHARED" + else: + label = "" + if label != "": + fs_options = "-L " + label + mount_source = "LABEL=" + label + if "mount_point" in m.keys(): + mp = m['mount_point'] + fs_info = { "fs_device": fs_device, "fs_type": m['fs_type'], "mp": mp, "fs_options": fs_options, "mount_source": mount_source } + temp_list.append(fs_info) + final_list.append(temp_list) + else: + temp_list = [] + fs_device = v['device'][0] + "1" + fs_options = "" + label = "" + mount_source = fs_device + mp = None + if "mount_point" in v.keys(): + mp = v['mount_point'] + if mp == "/hana/data": + label = "HANA_DATA" + elif mp == "/hana/log": + label = "HANA_LOG" + elif mp == "/hana/shared": + label = "HANA_SHARED" + else: + label = "" + if label != "": + fs_options = "-L " + label + mount_source = "LABEL=" + label + fs_info = { "fs_device": fs_device, "fs_type": v['fs_type'], "mp": mp, "fs_options": fs_options, "mount_source": mount_source } + temp_list.append(fs_info) + final_list.append(temp_list) + return final_list diff --git a/schematics/ansible/roles/saphanareq/filter_plugins/lvmdata.py b/schematics/ansible/roles/saphanareq/filter_plugins/lvmdata.py new file mode 100644 index 0000000..bedf950 --- /dev/null +++ b/schematics/ansible/roles/saphanareq/filter_plugins/lvmdata.py @@ -0,0 +1,45 @@ +#!/usr/bin/python + +class FilterModule(object): + '''Data related to LVM for HANA VM''' + + def filters(self): + return { + 'lvmdata': self.lvmdata + } + + def lvmdata(self, data_map): + final_list = [] + for k, v in data_map.items(): + key_to_check = 'lvm' + if key_to_check in v: + # In case the sum of the sizes of all LVs from the VG is lower than VG size + # and we don't want 'hana_data_lv' to be created as '100%FREE' + lv100free = True + total_lv_size = 0 + vgsize = 0 + for t in v['disk_size']: + vgsize += int(t) + lvminfo = v['lvm']['lv'] + for n in lvminfo: + total_lv_size += int(n['lv_size']) + if vgsize > total_lv_size: + lv100free = False + for m in v['lvm']['lv']: + temp_list = [] + lv_size = "" + # For HANA VMs, SWAP size is always 2 GB + # The volume group 'hana_vg' will always contain logical volume 'hana_data_lv' + if k == 'swap' or (k == 'hana_vg' and m['lv_name'] != 'hana_data_lv') or (lv100free == False and k == 'hana_vg' and m['lv_name'] == 'hana_data_lv'): + lv_size = m['lv_size'] + "G" + else: + lv_size = '100%FREE' + lvm_info = { "vg_name": v['lvm']['vg']['vg_name'], "lv_name": m['lv_name'], "lv_size": lv_size, "lv_stripes": m['lv_stripes'], "lv_stripe_size": m['lv_stripe_size'] } + temp_list.append(lvm_info) + final_list.append(temp_list) + for i in range(len(final_list)): + # LVM data 'hana_data_lv' should be last in array (in case it will be created in 'hana_vg') as we want 100%FREE as size + if final_list[i][0]['vg_name'] == 'hana_vg' and final_list[i][0]['lv_name'] == 'hana_data_lv': + final_list.append(final_list.pop(i)) + break + return final_list diff --git a/schematics/ansible/roles/saphanareq/filter_plugins/partitionlist.py b/schematics/ansible/roles/saphanareq/filter_plugins/partitionlist.py new file mode 100644 index 0000000..dd8f7e1 --- /dev/null +++ b/schematics/ansible/roles/saphanareq/filter_plugins/partitionlist.py @@ -0,0 +1,17 @@ +#!/usr/bin/python + +class FilterModule(object): + '''List of devices for partitions on HANA VM''' + + def filters(self): + return { + 'partitionlist': self.partitionlist + } + + def partitionlist(self, data_map): + final_list = [] + for k, v in data_map.items(): + key_to_check = 'lvm' + if key_to_check not in v: + final_list.append(v['device']) + return final_list diff --git a/schematics/ansible/roles/saphanareq/filter_plugins/storagedetails.py b/schematics/ansible/roles/saphanareq/filter_plugins/storagedetails.py new file mode 100644 index 0000000..4471592 --- /dev/null +++ b/schematics/ansible/roles/saphanareq/filter_plugins/storagedetails.py @@ -0,0 +1,100 @@ +#!/usr/bin/python + +import decimal +import re + +class FilterModule(object): + '''Storage details from profile containing also the devices for HANA VM''' + + def filters(self): + return { + 'storagedetails': self.storagedetails + } + + def storagedetails(self, data_list): + # data_list[0] - json file data + # data_list[1] - ansible_devices data + # data_list[2] - selected storage profile + json_file_data = data_list[0] + ansible_devices_data = data_list[1] + hana_profile = data_list[2] + + storage_profile_info = json_file_data['profiles'][hana_profile]['storage'] + + # Create a sorted list with all disks device keys available on the VM + pattern = 'dm-' + all_disk_device_keys = sorted([item for item in ansible_devices_data if re.match(pattern, item) == None]) + + # Get the number of the disks to be configured + necessary_disks_number = "" + count_disks = 0 + for k, v in storage_profile_info.items(): + count_disks += int(v['disk_count']) + necessary_disks_number = str(count_disks) + + # Get a list with the device keys for disks to be configured + N = int(necessary_disks_number) + disk_device_keys = all_disk_device_keys[-N:] + + # Get a list with the provisioned disk sizes corresponding to the device keys for disks to be configured + size_provisioned_disks = [] + for m, n in ansible_devices_data.items(): + if m in disk_device_keys and 'KB' not in n['size']: + size_provisioned_disks.append(n['size']) + + # Sort the list with provisioned disk sizes + size_provisioned_disks_sorted = sorted(size_provisioned_disks) + + # Get a list of disk sizes corresponding to the selected profile + size_profile_disks = [] + for k, v in storage_profile_info.items(): + display_size = "" + if int(v['disk_size']) >= 1024: + rounded_val = round(decimal.Decimal(int(v['disk_size']) / 1024), 2) + no_decimal_places = abs(rounded_val.as_tuple().exponent) + if no_decimal_places == 0: + display_size = str(rounded_val) + ".00 TB" + elif no_decimal_places == 1: + display_size = str(rounded_val) + "0 TB" + elif no_decimal_places == 2: + display_size = str(rounded_val) + " TB" + else: + display_size = v['disk_size'] + ".00 GB" + for t in range(int(v['disk_count'])): + size_profile_disks.append(display_size) + + # Sort the list with disk sizes from profile + size_profile_disks_sorted = sorted(size_profile_disks) + + # Get the missing disks + if (len(list(set(size_profile_disks_sorted) - set(size_provisioned_disks_sorted))) > 0) or (len(size_profile_disks_sorted) != len(size_provisioned_disks_sorted)): + msg = "The disks required for profile '" + hana_profile + "' are missing. The following disks sizes are required: " + str(size_profile_disks_sorted)[1:-1] + ". The following disk sizes were deployed: " + str(size_provisioned_disks_sorted)[1:-1] + return msg + else: + temp_list = [] + for k, v in storage_profile_info.items(): + new_list1 = [] + new_list2 = [] + display_size = "" + if int(v['disk_size']) >= 1024: + rounded_val = round(decimal.Decimal(int(v['disk_size']) / 1024), 2) + no_decimal_places = abs(rounded_val.as_tuple().exponent) + if no_decimal_places == 0: + display_size = str(rounded_val) + ".00 TB" + elif no_decimal_places == 1: + display_size = str(rounded_val) + "0 TB" + elif no_decimal_places == 2: + display_size = str(rounded_val) + " TB" + else: + display_size = v['disk_size'] + ".00 GB" + for t in range(int(v['disk_count'])): + new_list1.append(v['disk_size']) + for m, n in ansible_devices_data.items(): + if (n['size'] == display_size) and (m in disk_device_keys) and (m not in temp_list): + new_list2.append("/dev/" + m) + temp_list.append(m) + break + storage_profile_info[k]['disk_size'] = new_list1 + storage_profile_info[k]['device'] = new_list2 + final_storage = storage_profile_info + return final_storage diff --git a/schematics/ansible/roles/saphanareq/tasks/configurations/filesystems.yml b/schematics/ansible/roles/saphanareq/tasks/configurations/filesystems.yml index 73c5479..4dccade 100644 --- a/schematics/ansible/roles/saphanareq/tasks/configurations/filesystems.yml +++ b/schematics/ansible/roles/saphanareq/tasks/configurations/filesystems.yml @@ -1,148 +1,116 @@ --- -- name: Get available storage devices for swap - set_fact: - swap_disk: "{{ swap_disk|default([]) + [device.key] }}" - when: - - not device.value.partitions - - not device.value.holders - - device.key is search('vd') - - device.value.size == swap_disk_size - loop: "{{ ansible_devices | dict2items }}" - loop_control: - loop_var: device - -- name: Check if the required storage device for swap is found +# Storage sizing +# https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc (Updated on 2023-03-08) +# https://cloud.ibm.com/docs/sap?topic=sap-storage-design-considerations#hana-iaas-mx2-16x128-32x256-configure (Updated on 2022-05-19) +# https://cloud.ibm.com/docs/sap?topic=sap-storage-design-considerations#hana-iaas-mx2-48x384-configure (Updated on 2022-05-19) +# SAP Notes: +# - 2779331 - HANA services use large SWAP memory (v5) + +- name: Check if the JSON file for SAP HANA storage configuration is available on Ansible controller + stat: + path: "{{ playbook_dir }}/hana_volume_layout.json" + register: json_storage_file_status + delegate_to: localhost + +- name: Fail if the JSON file is missing fail: - msg: "Could not find a free {{ swap_disk_size }} storage device for swap" - when: swap_disk is not defined + msg: "The file {{ playbook_dir }}/hana_volume_layout.json is missing." + when: not json_storage_file_status.stat.exists -- name: Create a volume group for swap - lvg: - vg: "{{ hana_sid|lower }}_swap_vg" - pvs: "/dev/{{ swap_disk[0] }}" - pesize: "32" +- name: Get the JSON file content + shell: "cat {{ playbook_dir }}/hana_volume_layout.json" + register: result + changed_when: false + when: json_storage_file_status.stat.exists + delegate_to: localhost -- name: Get available storage devices for HANA VG +- name: Save the JSON data to a variable as a fact set_fact: - data_disk: "{{ data_disk|default([]) + ['/dev/' + device.key] }}" - when: - - not device.value.partitions - - not device.value.holders - - device.key is search('vd') - - device.value.size == hana_disk_size - loop: "{{ ansible_devices | dict2items }}" - loop_control: - loop_var: device + jsondata: "{{ result.stdout | from_json }}" -- name: Check if the required storage device for HANA VG is found +- name: Check if the chosen profile is certified for HANA VSIs fail: - msg: "Could not find the required free {{ hana_disk_size }} storage devices for HANA VG" - when: data_disk|length < 3 + msg: "The chosen profile {{ hana_profile }} is not certified for HANA VSIs." + when: hana_profile not in jsondata.profiles.keys() -- name: Create a volume group for HANA DB - lvg: - vg: "{{ hana_sid|lower }}_hana_vg" - pvs: "{{ data_disk }}" - pesize: "32" +- name: Detect the appropriate disks to be configured + set_fact: + final_storage: "{{ [jsondata, ansible_devices, hana_profile] | list | storagedetails }}" -- name: Create a logical volume for swap - lvol: - vg: "{{ hana_sid|lower }}_swap_vg" - lv: "{{ hana_sid|lower }}_swap_lv" - size: "{{ swap_lv_size }}" +- name: Get the missing disks + fail: + msg: "{{ final_storage }}" + when: final_storage is not mapping -- name: Create a logical volume for HANA data - lvol: - vg: "{{ hana_sid|lower }}_hana_vg" - lv: "{{ hana_sid|lower }}_hana_data_lv" - size: "{{ hana_data_lv_size }}" - opts: -i3 -I256 +- name: Create the volume groups + lvg: + vg: "{{ hana_sid | lower }}_{{ stg_details.value.lvm.vg.vg_name }}" + pvs: "{{ stg_details.value.device | join(',') }}" + pesize: "{{ stg_details.value.lvm.vg.pe_size_MB }}" + loop: "{{ final_storage | dict2items }}" + loop_control: + loop_var: stg_details + when: '"lvm" in stg_details.value.keys()' -- name: Create a logical volume for HANA log +- name: Create the logical volumes lvol: - vg: "{{ hana_sid|lower }}_hana_vg" - lv: "{{ hana_sid|lower }}_hana_log_lv" - size: "{{ hana_log_lv_size }}" - opts: -i3 -I64 + vg: "{{ hana_sid|lower }}_{{ lvm_data[0]['vg_name'] }}" + lv: "{{ hana_sid|lower }}_{{ lvm_data[0]['lv_name'] }}" + size: "{{ lvm_data[0]['lv_size'] }}" + opts: "-i{{ lvm_data[0]['lv_stripes'] }} -I{{ lvm_data[0]['lv_stripe_size'] }}" + shrink: false + loop: "{{ final_storage | lvmdata }}" + loop_control: + loop_var: lvm_data + +- name: Create the partitions + parted: + device: "{{ part[0] }}" + number: 1 + label: gpt + state: present + loop: "{{ final_storage | partitionlist }}" + loop_control: + loop_var: part + +- name: Create the filesystems + filesystem: + fstype: "{{ fs_data[0]['fs_type'] }}" + dev: "{{ fs_data[0]['fs_device'] }}" + opts: "{{ fs_data[0]['fs_options'] }}" + loop: "{{ [final_storage, hana_sid | lower] | filesystemdata }}" + loop_control: + loop_var: fs_data -- name: Create a logical volume for HANA shared - lvol: - vg: "{{ hana_sid|lower }}_hana_vg" - lv: "{{ hana_sid|lower }}_hana_shared_lv" - size: "{{ hana_shared_lv_size }}" - opts: -i3 +- name: Mount the filesystems + mount: + path: "{{ mp_data[0]['mp'] }}" + src: "{{ mp_data[0]['mount_source'] }}" + fstype: "{{ mp_data[0]['fs_type'] }}" + state: mounted + loop: "{{ [final_storage, hana_sid | lower] | filesystemdata }}" + loop_control: + loop_var: mp_data + when: mp_data[0]['mp'] != None -- name: Create a logical volume for /usr/sap - lvol: - vg: "{{ hana_sid|lower }}_hana_vg" - lv: "{{ hana_sid|lower }}_sap_lv" - size: "{{ sap_lv_size }}" - opts: -i3 - -- name: Create a swap filesystem - filesystem: - fstype: swap - dev: "/dev/{{ hana_sid|lower }}_swap_vg/{{ hana_sid|lower }}_swap_lv" - -- name: Create filesystem for /hana/data - filesystem: - fstype: xfs - dev: "/dev/{{ hana_sid|lower }}_hana_vg/{{ hana_sid|lower }}_hana_data_lv" - -- name: Create filesystem for /hana/log - filesystem: - fstype: xfs - dev: "/dev/{{ hana_sid|lower }}_hana_vg/{{ hana_sid|lower }}_hana_log_lv" - -- name: Create filesystem for /hana/shared - filesystem: - fstype: xfs - dev: "/dev/{{ hana_sid|lower }}_hana_vg/{{ hana_sid|lower }}_hana_shared_lv" - -- name: Create filesystem for /usr/sap - filesystem: - fstype: xfs - dev: "/dev/{{ hana_sid|lower }}_hana_vg/{{ hana_sid|lower }}_sap_lv" - -- name: Add swap device to /etc/fstab - lineinfile: - path: /etc/fstab - regexp: "^/dev/{{ hana_sid|lower }}_swap_vg/{{ hana_sid|lower }}_swap_lv" - line: "/dev/{{ hana_sid|lower }}_swap_vg/{{ hana_sid|lower }}_swap_lv swap swap defaults 0 0" +- name: Get SWAP LV name + set_fact: + swap_lv: "{{ swap_data[0]['fs_device'] }}" + loop: "{{ [final_storage, hana_sid | lower] | filesystemdata }}" + loop_control: + loop_var: swap_data -- name: Check the current swap size +- name: Check the current SWAP size set_fact: hana_vm_swap: "{{ ansible_swaptotal_mb }}" -- name: Mount swap volume - command: swapon -a +- name: Mount SWAP volume + command: "swapon -av {{ swap_lv }}" when: hana_vm_swap == 0 -- name: Mount /hana/data and add it to /etc/fstab - mount: - path: "/hana/data" - src: "/dev/{{ hana_sid|lower }}_hana_vg/{{ hana_sid|lower }}_hana_data_lv" - fstype: xfs - state: mounted - -- name: Mount /hana/log and add it to /etc/fstab - mount: - path: "/hana/log" - src: "/dev/{{ hana_sid|lower }}_hana_vg/{{ hana_sid|lower }}_hana_log_lv" - fstype: xfs - state: mounted - -- name: Mount /hana/shared and add it to /etc/fstab - mount: - path: "/hana/shared" - src: "/dev/{{ hana_sid|lower }}_hana_vg/{{ hana_sid|lower }}_hana_shared_lv" - fstype: xfs - state: mounted - -- name: Mount /usr/sap and add it to /etc/fstab - mount: - path: "/usr/sap" - src: "/dev/{{ hana_sid|lower }}_hana_vg/{{ hana_sid|lower }}_sap_lv" - fstype: xfs - state: mounted +- name: Add SWAP device to /etc/fstab + lineinfile: + path: /etc/fstab + regexp: "^{{ swap_lv }}" + line: "{{ swap_lv }} swap swap defaults 0 0" ... diff --git a/schematics/ansible/roles/saphanareq/tasks/configurations/hostname_fix_RedHat.yml b/schematics/ansible/roles/saphanareq/tasks/configurations/hostname_fix_RedHat.yml index 6e3dd62..3267f1f 100644 --- a/schematics/ansible/roles/saphanareq/tasks/configurations/hostname_fix_RedHat.yml +++ b/schematics/ansible/roles/saphanareq/tasks/configurations/hostname_fix_RedHat.yml @@ -16,4 +16,10 @@ path: /etc/hosts regexp: "^(?!{{ ansible_default_ipv4.address }}.*{{ sap_short_hostname.stdout }})(.*)({{ sap_short_hostname.stdout }}.*)" replace: '\1' + +- name: Disable ipv6 localhost + replace: + path: /etc/hosts + regexp: '^\:\:1(\s)' + replace: '# ::1 \1' ... diff --git a/schematics/ansible/roles/saphanareq/tasks/configurations/kernel_RedHat7.yml b/schematics/ansible/roles/saphanareq/tasks/configurations/kernel_RedHat7.yml deleted file mode 100644 index fd519a8..0000000 --- a/schematics/ansible/roles/saphanareq/tasks/configurations/kernel_RedHat7.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: Set recommended kernel parameters for SAP HANA DB on RedHat 7 - sysctl: - sysctl_file: /etc/sysctl.d/sap.conf - name: "{{ kernel_param.name }}" - value: "{{ kernel_param.value }}" - sysctl_set: yes - state: present - reload: yes - loop: - - { name: net.core.somaxconn, value: 4096 } - - { name: net.ipv4.tcp_max_syn_backlog, value: 8192 } - - { name: net.ipv4.tcp_slow_start_after_idle, value: 0 } - - { name: net.ipv4.tcp_syn_retries, value: 8 } - loop_control: - loop_var: kernel_param -... \ No newline at end of file diff --git a/schematics/ansible/roles/saphanareq/tasks/configurations/tmpfs.yml b/schematics/ansible/roles/saphanareq/tasks/configurations/tmpfs.yml new file mode 100644 index 0000000..ef306ad --- /dev/null +++ b/schematics/ansible/roles/saphanareq/tasks/configurations/tmpfs.yml @@ -0,0 +1,49 @@ +--- +# TMPFS sizing +# SAP Notes: +# - 2772999 - Red Hat Enterprise Linux 8.x: Installation and Configuration (v22) +# - 941735 - SAP memory management system for 64-bit Linux systems (v11) + +- name: Get the RAM size + set_fact: + hana_ram_g: "{{ hana_profile.split('-')[1].split('x')[1] }}" + +- name: Set swap logical volume size for RAM higher than 8192 + set_fact: + swap_lv_size_g: "2" + +- name: Get the current tmpfs mount data + shell: set -o pipefail && df -h |grep tmpfs|grep shm| awk '{print $2}' + args: + executable: /bin/bash + register: tmpfs_crt_data + changed_when: false + when: swap_lv_size_g is defined + +- name: Compute tmpfs size + set_fact: + tmpfs_size_g: "{{ ((hana_ram_g | float + swap_lv_size_g | float) * 0.75) | round | int }}" + +- name: Current tmpfs size + set_fact: + crt_tmpfs_size_g: "{{ tmpfs_crt_data.stdout | regex_search('^[0-9]+') | float | round | int }}" + +- name: Difference between current size and expected one + set_fact: + difference_size: "{{ (crt_tmpfs_size_g | float - tmpfs_size_g | float) | abs }}" + +- name: Remount tmpfs + mount: + path: /dev/shm + src: tmpfs + fstype: tmpfs + opts: "size={{ tmpfs_size_g }}G,rw,nosuid,nodev 0 0" + state: remounted + when: difference_size | int > 1 + +- name: Add tmpfs device to /etc/fstab + lineinfile: + path: /etc/fstab + regexp: "^/dev/shm (.*)$" + line: "tmpfs /dev/shm tmpfs size={{ tmpfs_size_g }}G,rw,nosuid,nodev 0 0" +... diff --git a/schematics/ansible/roles/saphanareq/tasks/configurations/update_RedHat7.yml b/schematics/ansible/roles/saphanareq/tasks/configurations/update_RedHat7.yml deleted file mode 100644 index 4824910..0000000 --- a/schematics/ansible/roles/saphanareq/tasks/configurations/update_RedHat7.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -- name: Enable repository for compat-sap-c++-9 - rhsm_repository: - name: "{{ repo_name }}" - state: enabled - loop: - # - rhel-sap-for-rhel-7-server-e4s-rpms - - rhel-7-server-rpms - - rhel-sap-hana-for-rhel-7-server-rpms - - rhel-7-server-eus-rpms - loop_control: - loop_var: repo_name - -- name: Update all packages # noqa 403 - yum: - name: '*' - state: latest -... diff --git a/schematics/ansible/roles/saphanareq/vars/RedHat7.yml b/schematics/ansible/roles/saphanareq/vars/RedHat7.yml deleted file mode 100644 index 526ee96..0000000 --- a/schematics/ansible/roles/saphanareq/vars/RedHat7.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -saphana_required_packages: - - expect - - krb5-workstation - - krb5-libs - - libaio - - libcanberra-gtk2 - - libicu - - libssh2 - - libtool-ltdl - - numactl - - openssl - - PackageKit-gtk3-module - - rsyslog - - sudo - - tcsh - - rsyslog - - xorg-x11-xauth - - xulrunner - - gtk2 - - cairo - - graphviz - - iptraf-ng - - lm_sensors - - nfs-utils - - bind-utils - - net-tools - - compat-sap-c++-9 - - libatomic - - chrony - -saphana_required_package_groups: - - "@base" - -saphana_required_configurations: - - "repository_RedHat" - - "update_RedHat7" - - "reqpkggroups_RedHat" - - "reqpkg" - - "hostname_fix_RedHat" - - "filesystems" - - "tuned" - - "SELinux" - - "firewalld" - - "symlinks" - - "abrtd" - - "kdump" - - "limits" - - "tmpfiles" - - "kernel_RedHat7" - - "reboot" -... diff --git a/schematics/ansible/roles/saphanareq/vars/RedHat8.yml b/schematics/ansible/roles/saphanareq/vars/RedHat8.yml index 38a79ca..7c8f2c9 100644 --- a/schematics/ansible/roles/saphanareq/vars/RedHat8.yml +++ b/schematics/ansible/roles/saphanareq/vars/RedHat8.yml @@ -42,6 +42,7 @@ saphana_required_configurations: - "umask_RHEL" - "kernel_RedHat8" - "filesystems" + - "tmpfs" - "tuned" - "SELinux" - "firewalld" diff --git a/schematics/files/hana_volume_layout.json b/schematics/files/hana_volume_layout.json new file mode 100644 index 0000000..49f5612 --- /dev/null +++ b/schematics/files/hana_volume_layout.json @@ -0,0 +1,1477 @@ +{ + "profiles": { + "mx2-16x128": { + "storage": { + "hana_vg": { + "disk_size": "500", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "988", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + }, + { + "lv_name": "hana_log_lv", + "lv_size": "256", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + }, + { + "lv_name": "hana_shared_lv", + "lv_size": "256", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"], + "sap_business_one": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4"] + } + }, + "mx2-32x256": { + "storage": { + "hana_vg": { + "disk_size": "500", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "988", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + }, + { + "lv_name": "hana_log_lv", + "lv_size": "256", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + }, + { + "lv_name": "hana_shared_lv", + "lv_size": "256", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"], + "sap_business_one": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4"] + } + }, + "mx2-48x384": { + "storage": { + "hana_vg": { + "disk_size": "500", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "616", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + }, + { + "lv_name": "hana_shared_lv", + "lv_size": "384", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "log": { + "disk_size": "100", + "disk_count": "4", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "400", + "lv_stripes": "4", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"], + "sap_business_one": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4"] + } + }, + "vx2d-16x224": { + "storage": { + "hana_vg": { + "disk_size": "1120", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "672", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + }, + { + "lv_name": "hana_log_lv", + "lv_size": "224", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + }, + { + "lv_name": "hana_shared_lv", + "lv_size": "224", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "vx2d-44x616": { + "storage": { + "data": { + "disk_size": "1848", + "disk_count": "1", + "iops": "10iops-tier", + "fs_type": "xfs", + "mount_point": "/hana/data" + }, + "shared": { + "disk_size": "616", + "disk_count": "1", + "iops": "5iops-tier", + "fs_type": "xfs", + "mount_point": "/hana/shared" + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"], + "olap": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "vx2d-88x1232": { + "storage": { + "data": { + "disk_size": "3696", + "disk_count": "1", + "iops": "10iops-tier", + "fs_type": "xfs", + "mount_point": "/hana/data" + }, + "shared": { + "disk_size": "1232", + "disk_count": "1", + "iops": "5iops-tier", + "fs_type": "xfs", + "mount_point": "/hana/shared" + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"], + "olap": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "vx2d-144x2016": { + "storage": { + "data": { + "disk_size": "1024", + "disk_count": "4", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_data_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "4096", + "lv_stripes": "4", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + } + ] + } + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "shared": { + "disk_size": "2016", + "disk_count": "1", + "iops": "5iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_shared_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_shared_lv", + "lv_size": "2016", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"], + "olap": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "vx2d-176x2464": { + "storage": { + "data": { + "disk_size": "1280", + "disk_count": "4", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_data_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "5120", + "lv_stripes": "4", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + } + ] + } + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "shared": { + "disk_size": "2464", + "disk_count": "1", + "iops": "5iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_shared_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_shared_lv", + "lv_size": "2464", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"], + "olap": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "ux2d-8x224": { + "storage": { + "hana_vg": { + "disk_size": "1120", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "672", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + }, + { + "lv_name": "hana_log_lv", + "lv_size": "224", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + }, + { + "lv_name": "hana_shared_lv", + "lv_size": "224", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "ux2d-16x448": { + "storage": { + "hana_vg": { + "disk_size": "2240", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "1344", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + }, + { + "lv_name": "hana_log_lv", + "lv_size": "448", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + }, + { + "lv_name": "hana_shared_lv", + "lv_size": "448", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "ux2d-36x1008": { + "storage": { + "data": { + "disk_size": "1008", + "disk_count": "2", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_data_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "2016", + "lv_stripes": "2", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + } + ] + } + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "shared": { + "disk_size": "1008", + "disk_count": "1", + "iops": "5iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_shared_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_shared_lv", + "lv_size": "1008", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "ux2d-48x1344": { + "storage": { + "data": { + "disk_size": "1350", + "disk_count": "2", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_data_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "2700", + "lv_stripes": "2", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + } + ] + } + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "shared": { + "disk_size": "1344", + "disk_count": "1", + "iops": "5iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_shared_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_shared_lv", + "lv_size": "1344", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "ux2d-72x2016": { + "storage": { + "data": { + "disk_size": "1024", + "disk_count": "4", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_data_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "4096", + "lv_stripes": "4", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + } + ] + } + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "shared": { + "disk_size": "2016", + "disk_count": "1", + "iops": "5iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_shared_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_shared_lv", + "lv_size": "2016", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "ux2d-100x2800": { + "storage": { + "data": { + "disk_size": "2100", + "disk_count": "4", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_data_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "8400", + "lv_stripes": "4", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + } + ] + } + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "shared": { + "disk_size": "2800", + "disk_count": "1", + "iops": "5iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_shared_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_shared_lv", + "lv_size": "2800", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + }, + "ux2d-200x5600": { + "storage": { + "data": { + "disk_size": "4200", + "disk_count": "4", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_data_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_data_lv", + "lv_size": "16800", + "lv_stripes": "4", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/data" + } + ] + } + }, + "log": { + "disk_size": "192", + "disk_count": "3", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_log_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_log_lv", + "lv_size": "576", + "lv_stripes": "3", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/log" + } + ] + } + }, + "shared": { + "disk_size": "5600", + "disk_count": "1", + "iops": "5iops-tier", + "lvm": { + "vg": { + "vg_name": "hana_shared_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "hana_shared_lv", + "lv_size": "5600", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/hana/shared" + } + ] + } + }, + "usr_sap": { + "disk_size": "50", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "usr_sap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "usr_sap_lv", + "lv_size": "50", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "xfs", + "mount_point": "/usr/sap" + } + ] + } + }, + "swap": { + "disk_size": "10", + "disk_count": "1", + "iops": "10iops-tier", + "lvm": { + "vg": { + "vg_name": "swap_vg", + "pe_size_MB": "32" + }, + "lv": [ + { + "lv_name": "swap_lv", + "lv_size": "2", + "lv_stripes": "1", + "lv_stripe_size": "64", + "fs_type": "swap" + } + ] + } + } + }, + "processing_type": { + "oltp": ["sles-12-4", "sles-12-5", "sles-15-1", "sles-15-2", "sles-15-3", "sles-15-4", "redhat-7-6", "redhat-7-9", "redhat-8-1", "redhat-8-2", "redhat-8-4", "redhat-8-6"] + } + } + } + } \ No newline at end of file diff --git a/schematics/generate-sap-paths.tf b/schematics/generate-sap-paths.tf index 20df3ad..1d2d17e 100644 --- a/schematics/generate-sap-paths.tf +++ b/schematics/generate-sap-paths.tf @@ -1,18 +1,18 @@ # List SAP PATHS resource "local_file" "KIT_SAP_PATHS" { content = <<-DOC -${var.kit_saphana_file} -${var.kit_sapcar_file} -${var.kit_swpm_file} -${var.kit_sapexe_file} -${var.kit_sapexedb_file} -${var.kit_igsexe_file} -${var.kit_igshelper_file} -${var.kit_saphotagent_file} -${var.kit_hdbclient_file} -${var.kit_s4hana_export}/* +${var.KIT_SAPHANA_FILE} +${var.KIT_SAPCAR_FILE} +${var.KIT_SWPM_FILE} +${var.KIT_SAPEXE_FILE} +${var.KIT_SAPEXEDB_FILE} +${var.KIT_IGSEXE_FILE} +${var.KIT_IGSHELPER_FILE} +${var.KIT_SAPHOSTAGENT_FILE} +${var.KIT_HDBCLIENT_FILE} +${var.KIT_S4HANA_EXPORT}/* DOC - filename = "modules/precheck-ssh-exec/sap-paths-${local.DB-HOSTNAME-1}" + filename = "modules/precheck-ssh-exec/sap-paths-${local.DB_HOSTNAME_1}" } diff --git a/schematics/integration.tf b/schematics/integration.tf index 82904fb..e01f5af 100644 --- a/schematics/integration.tf +++ b/schematics/integration.tf @@ -9,13 +9,13 @@ resource "local_file" "ha_ansible_infra-vars" { depends_on = [ module.db-vsi ] content = <<-DOC --- -#Ansible vars_file containing variable values passed from Terraform. -#Generated by "terraform plan&apply" command. +# Ansible vars_file containing variable values passed from Terraform. +# Generated by "terraform plan&apply" command. # INFRA variables -api_key: "${var.ibmcloud_api_key}" +api_key: "${var.IBMCLOUD_API_KEY}" region: "${var.REGION}" -ha_password: "${var.ha_password}" +ha_password: "${var.HA_PASSWORD}" hdb_iphost1: "${data.ibm_is_instance.db-vsi-1.primary_network_interface[0].primary_ip[0].address}" hdb_iphost2: "${data.ibm_is_instance.db-vsi-2.primary_network_interface[0].primary_ip[0].address}" @@ -66,29 +66,29 @@ resource "local_file" "app_ansible_saps4app-vars" { depends_on = [ module.db-vsi ] content = <<-DOC --- -#Ansible vars_file containing variable values passed from Terraform. -#Generated by "terraform plan&apply" command. - -#SAP system configuration -sap_sid: "${var.sap_sid}" -sap_ascs_instance_number: "${var.sap_ascs_instance_number}" -sap_ers_instance_number: "${var.sap_ers_instance_number}" -sap_ci_instance_number: "${var.sap_ci_instance_number}" -sap_aas_instance_number: "${var.sap_aas_instance_number}" -sap_main_password: "${var.sap_main_password}" - -hdb_concurrent_jobs: "${var.hdb_concurrent_jobs}" - -#SAP S/4HANA APP Installation kit path -kit_sapcar_file: "${var.kit_sapcar_file}" -kit_swpm_file: "${var.kit_swpm_file}" -kit_sapexe_file: "${var.kit_sapexe_file}" -kit_sapexedb_file: "${var.kit_sapexedb_file}" -kit_igsexe_file: "${var.kit_igsexe_file}" -kit_igshelper_file: "${var.kit_igshelper_file}" -kit_saphotagent_file: "${var.kit_saphotagent_file}" -kit_hdbclient_file: "${var.kit_hdbclient_file}" -kit_s4hana_export: "${var.kit_s4hana_export}" +# Ansible vars_file containing variable values passed from Terraform. +# Generated by "terraform plan&apply" command. + +# SAP system configuration +sap_sid: "${var.SAP_SID}" +sap_ascs_instance_number: "${var.SAP_ASCS_INSTANCE_NUMBER}" +sap_ers_instance_number: "${var.SAP_ERS_INSTANCE_NUMBER}" +sap_ci_instance_number: "${var.SAP_CI_INSTANCE_NUMBER}" +sap_aas_instance_number: "${var.SAP_AAS_INSTANCE_NUMBER}" +sap_main_password: "${var.SAP_MAIN_PASSWORD}" + +hdb_concurrent_jobs: "${var.HDB_CONCURRENT_JOBS}" + +# SAP S/4HANA APP Installation kit path +kit_sapcar_file: "${var.KIT_SAPCAR_FILE}" +kit_swpm_file: "${var.KIT_SWPM_FILE}" +kit_sapexe_file: "${var.KIT_SAPEXE_FILE}" +kit_sapexedb_file: "${var.KIT_SAPEXEDB_FILE}" +kit_igsexe_file: "${var.KIT_IGSEXE_FILE}" +kit_igshelper_file: "${var.KIT_IGSHELPER_FILE}" +kit_saphotagent_file: "${var.KIT_SAPHOSTAGENT_FILE}" +kit_hdbclient_file: "${var.KIT_HDBCLIENT_FILE}" +kit_s4hana_export: "${var.KIT_S4HANA_EXPORT}" ... DOC filename = "ansible/saps4app-vars.yml" @@ -100,19 +100,19 @@ resource "local_file" "db_ansible_saphana-vars" { depends_on = [ module.db-vsi ] content = <<-DOC --- -#Ansible vars_file containing variable values passed from Terraform. -#Generated by "terraform plan&apply" command. - -#HANA DB configuration -hana_sid: "${var.hana_sid}" -hana_profile: "${var.DB-PROFILE}" -hana_sysno: "${var.hana_sysno}" -hana_main_password: "${var.hana_main_password}" -hana_system_usage: "${var.hana_system_usage}" -hana_components: "${var.hana_components}" - -#SAP HANA Installation kit path -kit_saphana_file: "${var.kit_saphana_file}" +# Ansible vars_file containing variable values passed from Terraform. +# Generated by "terraform plan&apply" command. +hana_profile: "${var.DB_PROFILE}" + +# HANA DB configuration +hana_sid: "${var.HANA_SID}" +hana_sysno: "${var.HANA_SYSNO}" +hana_main_password: "${var.HANA_MAIN_PASSWORD}" +hana_system_usage: "${var.HANA_SYSTEM_USAGE}" +hana_components: "${var.HANA_COMPONENTS}" + +# SAP HANA Installation kit path +kit_saphana_file: "${var.KIT_SAPHANA_FILE}" ... DOC filename = "ansible/saphana-vars.yml" @@ -130,3 +130,10 @@ resource "null_resource" "file_shares_ansible_vars" { EOF } } + +# Export Terraform variable values to an Ansible var_file +resource "local_file" "tf_ansible_hana_storage_generated_file" { + depends_on = [ module.db-vsi ] + source = "files/hana_volume_layout.json" + filename = "ansible/hana_volume_layout.json" +} diff --git a/schematics/main.tf b/schematics/main.tf index 2c4f8b0..36f0c77 100644 --- a/schematics/main.tf +++ b/schematics/main.tf @@ -6,8 +6,8 @@ module "precheck-ssh-exec" { source = "./modules/precheck-ssh-exec" depends_on = [ module.pre-init ] BASTION_FLOATING_IP = var.BASTION_FLOATING_IP - private_ssh_key = var.private_ssh_key - HOSTNAME = "${local.DB-HOSTNAME-1}" + PRIVATE_SSH_KEY = var.PRIVATE_SSH_KEY + HOSTNAME = "${local.DB_HOSTNAME_1}" SECURITY_GROUP = var.SECURITY_GROUP } @@ -26,7 +26,7 @@ module "pg" { ZONE = var.ZONE VPC = var.VPC RESOURCE_GROUP = var.RESOURCE_GROUP - SAP_SID = var.sap_sid + SAP_SID = var.SAP_SID } module "db-vsi" { @@ -38,20 +38,18 @@ module "db-vsi" { SUBNET = var.SUBNET RESOURCE_GROUP = var.RESOURCE_GROUP PLACEMENT_GROUP = module.pg.PLACEMENT_GROUP - PROFILE = var.DB-PROFILE - IMAGE = var.DB-IMAGE + PROFILE = var.DB_PROFILE + IMAGE = var.DB_IMAGE SSH_KEYS = var.SSH_KEYS - VOLUME_SIZES = [ "500" , "500" , "500" , "10" ] - VOL_PROFILE = "10iops-tier" - SAP_SID = var.sap_sid + SAP_SID = var.SAP_SID for_each ={ - "hanadb-1" = {DB-HOSTNAME = "${var.DB-HOSTNAME-1}" , DB-HOSTNAME-DEFAULT = "hanadb-${var.hana_sid}-1"} - "hanadb-2" = {DB-HOSTNAME = "${var.DB-HOSTNAME-2}" , DB-HOSTNAME-DEFAULT = "hanadb-${var.hana_sid}-2"} + "hanadb-1" = { DB-HOSTNAME = lower("${var.DB_HOSTNAME_1}") , DB-HOSTNAME-DEFAULT = lower("hanadb-${var.HANA_SID}-1"), DB_REAL_HOSTNAME = lower("${var.DB_HOSTNAME_1}") != "hanadb-1" ? lower("${var.DB_HOSTNAME_1}") : lower("hanadb-${var.HANA_SID}-1") } + "hanadb-2" = { DB-HOSTNAME = lower("${var.DB_HOSTNAME_2}") , DB-HOSTNAME-DEFAULT = lower("hanadb-${var.HANA_SID}-2"), DB_REAL_HOSTNAME = lower("${var.DB_HOSTNAME_2}") != "hanadb-2" ? lower("${var.DB_HOSTNAME_2}") : lower("hanadb-${var.HANA_SID}-2") } } DB-HOSTNAME = "${each.value.DB-HOSTNAME}" INPUT-DEFAULT-HOSTNAME = "${each.key}" FINAL-DEFAULT-HOSTNAME = lower ("${each.value.DB-HOSTNAME-DEFAULT}") - + REAL_HOSTNAME = "${each.value.DB_REAL_HOSTNAME}" } module "app-vsi" { @@ -63,81 +61,55 @@ module "app-vsi" { SUBNET = var.SUBNET RESOURCE_GROUP = var.RESOURCE_GROUP PLACEMENT_GROUP = module.pg.PLACEMENT_GROUP - PROFILE = var.APP-PROFILE - IMAGE = var.APP-IMAGE + PROFILE = var.APP_PROFILE + IMAGE = var.APP_IMAGE SSH_KEYS = var.SSH_KEYS VOLUME_SIZES = [ "40" ] VOL_PROFILE = "10iops-tier" - SAP_SID = var.sap_sid + SAP_SID = var.SAP_SID for_each ={ - "sapapp-1" = {APP-HOSTNAME = "${var.APP-HOSTNAME-1}" , APP-HOSTNAME-DEFAULT = "sapapp-${var.sap_sid}-1"} - "sapapp-2" = {APP-HOSTNAME = "${var.APP-HOSTNAME-2}" , APP-HOSTNAME-DEFAULT = "sapapp-${var.sap_sid}-2"} + "sapapp-1" = { APP-HOSTNAME = lower("${var.APP_HOSTNAME_1}") , APP-HOSTNAME-DEFAULT = lower("sapapp-${var.SAP_SID}-1"), APP_REAL_HOSTNAME = lower("${var.APP_HOSTNAME_1}") != "sapapp-1" ? lower("${var.APP_HOSTNAME_1}") : lower("sapapp-${var.SAP_SID}-1") } + "sapapp-2" = { APP-HOSTNAME = lower("${var.APP_HOSTNAME_2}") , APP-HOSTNAME-DEFAULT = lower("sapapp-${var.SAP_SID}-2"), APP_REAL_HOSTNAME = lower("${var.APP_HOSTNAME_2}") != "sapapp-2" ? lower("${var.APP_HOSTNAME_2}") : lower("sapapp-${var.SAP_SID}-2") } } APP-HOSTNAME = "${each.value.APP-HOSTNAME}" INPUT-DEFAULT-HOSTNAME = "${each.key}" FINAL-DEFAULT-HOSTNAME = lower ("${each.value.APP-HOSTNAME-DEFAULT}") + REAL_HOSTNAME = "${each.value.APP_REAL_HOSTNAME}" } module "file-shares" { - depends_on = [ module.vpc-subnet , module.pg ] + depends_on = [ module.vpc-subnet, module.pg ] source = "./modules/file-shares" for_each = { - "usrsap-as1" = {size = var.usrsap-as1 , var_name = "as1", var_timeout = "1m" } - "usrsap-as2" = {size = var.usrsap-as2 , var_name = "as2" , var_timeout = "2m"} - "usrsap-sapascs" = {size = var.usrsap-sapascs , var_name = "sapascs", var_timeout = "3m" } - "usrsap-sapers" = {size = var.usrsap-sapers , var_name = "sapers", var_timeout = "4m" } - "usrsap-sapmnt" = {size = var.usrsap-sapmnt , var_name = "sapmnt", var_timeout = "5m" } - "usrsap-sapsys" = {size = var.usrsap-sapsys , var_name = "sapsys", var_timeout = "6m" } - "usrsap-trans" = {size = var.usrsap-trans , var_name = "trans" , var_timeout = "7m" } - } - api_key = var.ibmcloud_api_key - resource_group_id = data.ibm_resource_group.group.id - zone = var.ZONE - prefix = each.key - ansible_var_name = each.value.var_name - var_timeout = each.value.var_timeout - vpc_id = data.ibm_is_vpc.vpc.id - vpc = var.VPC - region = var.REGION - share_size = each.value.size - share_profile = var.share_profile - sap_sid = var.sap_sid -} - -module "file-shares-cleaning-up" { -depends_on = [ module.file-shares ] - source = "./modules/file-shares/cleaning-up" - for_each = { - "usrsap-as1" = {size = var.usrsap-as1 , var_name = "as1", var_timeout = "1m" } - "usrsap-as2" = {size = var.usrsap-as2 , var_name = "as2" , var_timeout = "3m"} - "usrsap-sapascs" = {size = var.usrsap-sapascs , var_name = "sapascs", var_timeout = "5m" } - "usrsap-sapers" = {size = var.usrsap-sapers , var_name = "sapers", var_timeout = "7m" } - "usrsap-sapmnt" = {size = var.usrsap-sapmnt , var_name = "sapmnt", var_timeout = "9m" } - "usrsap-sapsys" = {size = var.usrsap-sapsys , var_name = "sapsys", var_timeout = "11m" } - "usrsap-trans" = {size = var.usrsap-trans , var_name = "trans" , var_timeout = "13m" } + "usrsap-as1" = {size = var.USRSAP_AS1 , var_name = "as1" } + "usrsap-as2" = {size = var.USRSAP_AS2 , var_name = "as2" } + "usrsap-sapascs" = {size = var.USRSAP_SAPASCS , var_name = "sapascs" } + "usrsap-sapers" = {size = var.USRSAP_SAPERS , var_name = "sapers" } + "usrsap-sapmnt" = {size = var.USRSAP_SAPMNT , var_name = "sapmnt" } + "usrsap-sapsys" = {size = var.USRSAP_SAPSYS , var_name = "sapsys" } + "usrsap-trans" = {size = var.USRSAP_TRANS , var_name = "trans" } } - api_key = var.ibmcloud_api_key - resource_group_id = data.ibm_resource_group.group.id + api_key = var.IBMCLOUD_API_KEY + resource_group_id = data.ibm_resource_group.group.id zone = var.ZONE prefix = each.key ansible_var_name = each.value.var_name - var_timeout = each.value.var_timeout vpc_id = data.ibm_is_vpc.vpc.id vpc = var.VPC region = var.REGION share_size = each.value.size - share_profile = var.share_profile - sap_sid = var.sap_sid + share_profile = var.SHARE_PROFILE + sap_sid = var.SAP_SID } module "alb-prereq" { - depends_on = [ module.file-shares-cleaning-up ] + depends_on = [ module.file-shares ] source = "./modules/alb/prereq" for_each ={ - "${local.SAP-ALB-ASCS}" = {syd = var.sap_sid, delay ="1m"} - "${local.SAP-ALB-ERS}" = {syd = var.sap_sid, delay ="3m"} - "${local.DB-ALB-HANA}" = {syd = var.hana_sid, delay ="5m"} + "${local.SAP-ALB-ASCS}" = {syd = var.SAP_SID, delay ="1m"} + "${local.SAP-ALB-ERS}" = {syd = var.SAP_SID, delay ="3m"} + "${local.DB-ALB-HANA}" = {syd = var.HANA_SID, delay ="5m"} } SAP_ALB_NAME = "${each.key}" @@ -148,26 +120,26 @@ module "alb-prereq" { SUBNET = var.SUBNET RESOURCE_GROUP = var.RESOURCE_GROUP SAP_SID = "${each.value.syd}" - HANA_SYSNO = var.hana_sysno - SAP_ASCS = var.sap_ascs_instance_number - SAP_ERSNO = var.sap_ers_instance_number + HANA_SYSNO = var.HANA_SYSNO + SAP_ASCS = var.SAP_ASCS_INSTANCE_NUMBER + SAP_ERSNO = var.SAP_ERS_INSTANCE_NUMBER } module "alb-ascs" { - depends_on = [ module.alb-prereq , module.app-vsi ] + depends_on = [ module.alb-prereq, module.app-vsi, module.db-vsi ] source = "./modules/alb" SAP_HEALTH_MONITOR_PORT_PREFIX = "36" - SAP_HEALTH_MONITOR_PORT_POSTFIX = "${var.sap_ascs_instance_number}" + SAP_HEALTH_MONITOR_PORT_POSTFIX = "${var.SAP_ASCS_INSTANCE_NUMBER}" for_each = { - "backend-1" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "32" , port_postfix = "${var.sap_ascs_instance_number}", port_apostfix = ""} - "backend-2" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "36" , port_postfix = "${var.sap_ascs_instance_number}", port_apostfix = ""} - "backend-3" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "39" , port_postfix = "${var.sap_ascs_instance_number}", port_apostfix = ""} - "backend-4" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "81" , port_postfix = "${var.sap_ascs_instance_number}", port_apostfix = ""} - "backend-5" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "5" , port_postfix = "${var.sap_ascs_instance_number}", port_apostfix = "13"} - "backend-6" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "5" , port_postfix = "${var.sap_ascs_instance_number}", port_apostfix = "14"} - "backend-7" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "5" , port_postfix = "${var.sap_ascs_instance_number}", port_apostfix = "16"} + "backend-1" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "32" , port_postfix = "${var.SAP_ASCS_INSTANCE_NUMBER}", port_apostfix = ""} + "backend-2" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "36" , port_postfix = "${var.SAP_ASCS_INSTANCE_NUMBER}", port_apostfix = ""} + "backend-3" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "39" , port_postfix = "${var.SAP_ASCS_INSTANCE_NUMBER}", port_apostfix = ""} + "backend-4" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "81" , port_postfix = "${var.SAP_ASCS_INSTANCE_NUMBER}", port_apostfix = ""} + "backend-5" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "5" , port_postfix = "${var.SAP_ASCS_INSTANCE_NUMBER}", port_apostfix = "13"} + "backend-6" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "5" , port_postfix = "${var.SAP_ASCS_INSTANCE_NUMBER}", port_apostfix = "14"} + "backend-7" = { sap_alb_name ="${local.SAP-ALB-ASCS}", backend-name = "sap-ascs" , port_prefix = "5" , port_postfix = "${var.SAP_ASCS_INSTANCE_NUMBER}", port_apostfix = "16"} } SAP_ALB_NAME = "${each.value.sap_alb_name}" @@ -176,29 +148,29 @@ module "alb-ascs" { SECURITY_GROUP = var.SECURITY_GROUP SUBNET = var.SUBNET RESOURCE_GROUP = var.RESOURCE_GROUP - SAP_SID = var.sap_sid - HANA_SYSNO = var.hana_sysno - SAP_ASCS = var.sap_ascs_instance_number - SAP_ERSNO = var.sap_ers_instance_number + SAP_SID = var.SAP_SID + HANA_SYSNO = var.HANA_SYSNO + SAP_ASCS = var.SAP_ASCS_INSTANCE_NUMBER + SAP_ERSNO = var.SAP_ERS_INSTANCE_NUMBER SAP-PRIVATE-IP-VSI1 = "${data.ibm_is_instance.app-vsi-1.primary_network_interface[0].primary_ip[0].address}" SAP-PRIVATE-IP-VSI2 = "${data.ibm_is_instance.app-vsi-2.primary_network_interface[0].primary_ip[0].address}" - SAP_BACKEND_POOL_NAME = lower ("${each.value.backend-name}-${var.sap_sid}-${each.value.port_prefix}${var.sap_ascs_instance_number}${each.value.port_apostfix}") + SAP_BACKEND_POOL_NAME = lower ("${each.value.backend-name}-${var.SAP_SID}-${each.value.port_prefix}${var.SAP_ASCS_INSTANCE_NUMBER}${each.value.port_apostfix}") SAP_PORT_LB = "${each.value.port_prefix}${each.value.port_postfix}${each.value.port_apostfix}" } module "alb-ers" { - depends_on = [ module.alb-prereq ,module.app-vsi ] + depends_on = [ module.alb-prereq, module.app-vsi, module.db-vsi ] source = "./modules/alb" SAP_HEALTH_MONITOR_PORT_PREFIX = "32" - SAP_HEALTH_MONITOR_PORT_POSTFIX = "${var.sap_ers_instance_number}" + SAP_HEALTH_MONITOR_PORT_POSTFIX = "${var.SAP_ERS_INSTANCE_NUMBER}" for_each = { - "backend-1" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "32" , port_postfix = "${var.sap_ers_instance_number}", port_apostfix = ""} - "backend-2" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "33" , port_postfix = "${var.sap_ers_instance_number}", port_apostfix = ""} - "backend-3" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "5" , port_postfix = "${var.sap_ers_instance_number}", port_apostfix = "13"} - "backend-4" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "5" , port_postfix = "${var.sap_ers_instance_number}", port_apostfix = "14"} - "backend-5" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "5" , port_postfix = "${var.sap_ers_instance_number}", port_apostfix = "16"} + "backend-1" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "32" , port_postfix = "${var.SAP_ERS_INSTANCE_NUMBER}", port_apostfix = ""} + "backend-2" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "33" , port_postfix = "${var.SAP_ERS_INSTANCE_NUMBER}", port_apostfix = ""} + "backend-3" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "5" , port_postfix = "${var.SAP_ERS_INSTANCE_NUMBER}", port_apostfix = "13"} + "backend-4" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "5" , port_postfix = "${var.SAP_ERS_INSTANCE_NUMBER}", port_apostfix = "14"} + "backend-5" = { sap_alb_name ="${local.SAP-ALB-ERS}", backend-name = "sap-ers" , port_prefix = "5" , port_postfix = "${var.SAP_ERS_INSTANCE_NUMBER}", port_apostfix = "16"} } SAP_ALB_NAME = "${each.value.sap_alb_name}" @@ -207,32 +179,32 @@ module "alb-ers" { SECURITY_GROUP = var.SECURITY_GROUP SUBNET = var.SUBNET RESOURCE_GROUP = var.RESOURCE_GROUP - SAP_SID = var.sap_sid - HANA_SYSNO = var.hana_sysno - SAP_ASCS = var.sap_ascs_instance_number - SAP_ERSNO = var.sap_ers_instance_number + SAP_SID = var.SAP_SID + HANA_SYSNO = var.HANA_SYSNO + SAP_ASCS = var.SAP_ASCS_INSTANCE_NUMBER + SAP_ERSNO = var.SAP_ERS_INSTANCE_NUMBER SAP-PRIVATE-IP-VSI1 = "${data.ibm_is_instance.app-vsi-1.primary_network_interface[0].primary_ip[0].address}" SAP-PRIVATE-IP-VSI2 = "${data.ibm_is_instance.app-vsi-2.primary_network_interface[0].primary_ip[0].address}" - SAP_BACKEND_POOL_NAME = lower ("${each.value.backend-name}-${var.sap_sid}-${each.value.port_prefix}${each.value.port_postfix}${each.value.port_apostfix}") + SAP_BACKEND_POOL_NAME = lower ("${each.value.backend-name}-${var.SAP_SID}-${each.value.port_prefix}${each.value.port_postfix}${each.value.port_apostfix}") SAP_PORT_LB = "${each.value.port_prefix}${each.value.port_postfix}${each.value.port_apostfix}" } module "alb-hana" { - depends_on = [ module.alb-prereq , module.db-vsi ] + depends_on = [ module.alb-prereq, module.app-vsi, module.db-vsi ] source = "./modules/alb" SAP_HEALTH_MONITOR_PORT_PREFIX = "3" - SAP_HEALTH_MONITOR_PORT_POSTFIX = "${var.hana_sysno}13" + SAP_HEALTH_MONITOR_PORT_POSTFIX = "${var.HANA_SYSNO}13" for_each = { - "backend-1" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.hana_sysno}", port_apostfix = "13"} - "backend-2" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.hana_sysno}", port_apostfix = "14"} - "backend-3" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.hana_sysno}", port_apostfix = "15"} - "backend-4" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.hana_sysno}", port_apostfix = "40"} - "backend-5" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.hana_sysno}", port_apostfix = "41"} - "backend-6" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.hana_sysno}", port_apostfix = "42"} - "backend-7" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "5" , port_postfix = "${var.hana_sysno}", port_apostfix = "13"} - "backend-8" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "5" , port_postfix = "${var.hana_sysno}", port_apostfix = "14"} + "backend-1" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.HANA_SYSNO}", port_apostfix = "13"} + "backend-2" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.HANA_SYSNO}", port_apostfix = "14"} + "backend-3" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.HANA_SYSNO}", port_apostfix = "15"} + "backend-4" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.HANA_SYSNO}", port_apostfix = "40"} + "backend-5" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.HANA_SYSNO}", port_apostfix = "41"} + "backend-6" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "3" , port_postfix = "${var.HANA_SYSNO}", port_apostfix = "42"} + "backend-7" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "5" , port_postfix = "${var.HANA_SYSNO}", port_apostfix = "13"} + "backend-8" = { sap_alb_name ="${local.DB-ALB-HANA}", backend-name = "db-hana" , port_prefix = "5" , port_postfix = "${var.HANA_SYSNO}", port_apostfix = "14"} } SAP_ALB_NAME = "${each.value.sap_alb_name}" @@ -241,38 +213,38 @@ module "alb-hana" { SECURITY_GROUP = var.SECURITY_GROUP SUBNET = var.SUBNET RESOURCE_GROUP = var.RESOURCE_GROUP - SAP_SID = var.hana_sid - HANA_SYSNO = var.hana_sysno - SAP_ASCS = var.sap_ascs_instance_number - SAP_ERSNO = var.sap_ers_instance_number + SAP_SID = var.HANA_SID + HANA_SYSNO = var.HANA_SYSNO + SAP_ASCS = var.SAP_ASCS_INSTANCE_NUMBER + SAP_ERSNO = var.SAP_ERS_INSTANCE_NUMBER SAP-PRIVATE-IP-VSI1 = "${data.ibm_is_instance.db-vsi-1.primary_network_interface[0].primary_ip[0].address}" SAP-PRIVATE-IP-VSI2 = "${data.ibm_is_instance.db-vsi-2.primary_network_interface[0].primary_ip[0].address}" - SAP_BACKEND_POOL_NAME = lower ("${each.value.backend-name}-${var.hana_sid}-${each.value.port_prefix}${each.value.port_postfix}${each.value.port_apostfix}") + SAP_BACKEND_POOL_NAME = lower ("${each.value.backend-name}-${var.HANA_SID}-${each.value.port_prefix}${each.value.port_postfix}${each.value.port_apostfix}") SAP_PORT_LB = "${each.value.port_prefix}${each.value.port_postfix}${each.value.port_apostfix}" } module "dns" { - depends_on = [ module.alb-hana , module.file-shares-cleaning-up ] + depends_on = [ module.alb-hana, module.alb-ers, module.alb-ascs ] source = "./modules/dns" ZONE = var.ZONE REGION = var.REGION VPC = var.VPC RESOURCE_GROUP = var.RESOURCE_GROUP - SAP_SID = var.sap_sid + SAP_SID = var.SAP_SID ALB_ASCS_HOSTNAME = "${data.ibm_is_lb.alb-ascs.hostname}" ALB_ERS_HOSTNAME = "${data.ibm_is_lb.alb-ers.hostname}" ALB_HANA_HOSTNAME = "${data.ibm_is_lb.alb-hana.hostname}" DOMAIN_NAME = var.DOMAIN_NAME - ASCS-VIRT-HOSTNAME = var.ASCS-VIRT-HOSTNAME != "sapascs" ? var.ASCS-VIRT-HOSTNAME : lower ("${local.ASCS-VIRT-HOSTNAME}") - ERS-VIRT-HOSTNAME = var.ERS-VIRT-HOSTNAME != "sapers" ? var.ERS-VIRT-HOSTNAME : lower ("${local.ERS-VIRT-HOSTNAME}") - HANA-VIRT-HOSTNAME = var.HANA-VIRT-HOSTNAME != "dbhana" ? var.HANA-VIRT-HOSTNAME : lower ("${local.HANA-VIRT-HOSTNAME}") + ASCS_VIRT_HOSTNAME = var.ASCS_VIRT_HOSTNAME != "sapascs" ? var.ASCS_VIRT_HOSTNAME : lower ("${local.ASCS_VIRT_HOSTNAME}") + ERS_VIRT_HOSTNAME = var.ERS_VIRT_HOSTNAME != "sapers" ? var.ERS_VIRT_HOSTNAME : lower ("${local.ERS_VIRT_HOSTNAME}") + HANA_VIRT_HOSTNAME = var.HANA_VIRT_HOSTNAME != "dbhana" ? var.HANA_VIRT_HOSTNAME : lower ("${local.HANA_VIRT_HOSTNAME}") } module "ansible-deployment" { source = "./modules/ansible-exec" - depends_on = [ module.app-vsi, local_file.ansible_inventory, local_file.ha_ansible_infra-vars, local_file.app_ansible_saps4app-vars, local_file.db_ansible_saphana-vars, module.file-shares-cleaning-up, module.dns ] + depends_on = [ local_file.ansible_inventory, local_file.ha_ansible_infra-vars, local_file.app_ansible_saps4app-vars, local_file.db_ansible_saphana-vars, local_file.tf_ansible_hana_storage_generated_file, module.alb-hana, module.app-vsi, module.db-vsi, module.file-shares, module.dns ] IP = data.ibm_is_instance.app-vsi-1.primary_network_interface[0].primary_ip[0].address PLAYBOOK = "playbook.yml" BASTION_FLOATING_IP = var.BASTION_FLOATING_IP - private_ssh_key = var.private_ssh_key + PRIVATE_SSH_KEY = var.PRIVATE_SSH_KEY } diff --git a/schematics/modules/alb/lb.tf b/schematics/modules/alb/lb.tf index 990b42e..46cbcc9 100644 --- a/schematics/modules/alb/lb.tf +++ b/schematics/modules/alb/lb.tf @@ -116,7 +116,7 @@ resource "ibm_is_lb_listener" "sap-frontend" { protocol = "tcp" port = "${var.SAP_PORT_LB}" default_pool = ibm_is_lb_pool.sap-backend.pool_id - idle_connection_timeout = 50 + idle_connection_timeout = 300 } diff --git a/schematics/modules/ansible-exec/remote-exec.tf b/schematics/modules/ansible-exec/remote-exec.tf index 05d1fc0..17004b6 100644 --- a/schematics/modules/ansible-exec/remote-exec.tf +++ b/schematics/modules/ansible-exec/remote-exec.tf @@ -4,7 +4,7 @@ resource "null_resource" "ansible-exec" { type = "ssh" user = "root" host = var.BASTION_FLOATING_IP - private_key = var.private_ssh_key + private_key = var.PRIVATE_SSH_KEY timeout = "2m" } @@ -124,10 +124,32 @@ resource "null_resource" "ansible-logs4" { } -resource "null_resource" "ansible-errors" { +resource "null_resource" "ansible-logs5" { depends_on = [ null_resource.ansible-logs4 ] + provisioner "local-exec" { + command = "ssh -o 'StrictHostKeyChecking no' -i ansible/id_rsa root@${var.BASTION_FLOATING_IP} 'export IP=${var.IP}; export SAP_DEPLOYMENT=${local.SAP_DEPLOYMENT}; timeout 55m /tmp/${var.IP}.while.sh'" + on_failure = continue + } + +} + +resource "null_resource" "ansible-logs6" { + + depends_on = [ null_resource.ansible-logs5 ] + + provisioner "local-exec" { + command = "ssh -o 'StrictHostKeyChecking no' -i ansible/id_rsa root@${var.BASTION_FLOATING_IP} 'export IP=${var.IP}; export SAP_DEPLOYMENT=${local.SAP_DEPLOYMENT}; timeout 55m /tmp/${var.IP}.while.sh'" + on_failure = continue + } + +} + +resource "null_resource" "ansible-errors" { + + depends_on = [ null_resource.ansible-logs6 ] + provisioner "local-exec" { command = "ssh -o 'StrictHostKeyChecking no' -i ansible/id_rsa root@${var.BASTION_FLOATING_IP} 'export IP=${var.IP}; export SAP_DEPLOYMENT=${local.SAP_DEPLOYMENT}; timeout 5s /tmp/${var.IP}.error.sh'" on_failure = fail @@ -143,7 +165,7 @@ resource "null_resource" "ansible-delete-sensitive-data" { type = "ssh" user = "root" host = var.BASTION_FLOATING_IP - private_key = var.private_ssh_key + private_key = var.PRIVATE_SSH_KEY timeout = "1m" } diff --git a/schematics/modules/ansible-exec/variables.tf b/schematics/modules/ansible-exec/variables.tf index 7cce421..52d1c3e 100644 --- a/schematics/modules/ansible-exec/variables.tf +++ b/schematics/modules/ansible-exec/variables.tf @@ -13,7 +13,7 @@ variable "IP" { description = "IP used by ansible" } -variable "private_ssh_key" { +variable "PRIVATE_SSH_KEY" { type = string description = "Private ssh key" } diff --git a/schematics/modules/app-vsi/variables.tf b/schematics/modules/app-vsi/variables.tf index 98d22e0..6aa1e0f 100644 --- a/schematics/modules/app-vsi/variables.tf +++ b/schematics/modules/app-vsi/variables.tf @@ -71,4 +71,9 @@ variable "INPUT-DEFAULT-HOSTNAME" { variable "FINAL-DEFAULT-HOSTNAME" { type = string description = "APP VSI Hostname" -} \ No newline at end of file +} + +variable "REAL_HOSTNAME" { + type = string + description = "APP VSI Real Hostname" +} diff --git a/schematics/modules/app-vsi/volume.tf b/schematics/modules/app-vsi/volume.tf index de34219..e9a26bb 100644 --- a/schematics/modules/app-vsi/volume.tf +++ b/schematics/modules/app-vsi/volume.tf @@ -1,7 +1,7 @@ resource "ibm_is_volume" "vol" { count = length( var.VOLUME_SIZES ) - name = "${var.FINAL-DEFAULT-HOSTNAME}-vol${count.index}" + name = "${var.REAL_HOSTNAME}-vol${count.index}" zone = var.ZONE resource_group = data.ibm_resource_group.group.id capacity = var.VOLUME_SIZES[count.index] diff --git a/schematics/modules/db-vsi/output.tf b/schematics/modules/db-vsi/output.tf new file mode 100644 index 0000000..fab0679 --- /dev/null +++ b/schematics/modules/db-vsi/output.tf @@ -0,0 +1,3 @@ +output "STORAGE-LAYOUT" { + value = local.DISPLAY_CRT_STORAGE +} \ No newline at end of file diff --git a/schematics/modules/db-vsi/variables.tf b/schematics/modules/db-vsi/variables.tf index 4137c29..81d7def 100644 --- a/schematics/modules/db-vsi/variables.tf +++ b/schematics/modules/db-vsi/variables.tf @@ -30,7 +30,8 @@ variable "RESOURCE_GROUP" { variable "PROFILE" { type = string - description = "VSI Profile" + description = "DB VSI Profile" + default = "mx2-16x128" } variable "IMAGE" { @@ -43,16 +44,6 @@ variable "SSH_KEYS" { description = "List of SSH Keys to access the VSI" } -variable "VOLUME_SIZES" { - type = list(string) - description = "List of volume sizes in GB to be created" -} - -variable "VOL_PROFILE" { - type = string - description = "Volume profile" -} - variable "SAP_SID" { type = string description = "SAP SID" @@ -71,4 +62,27 @@ variable "INPUT-DEFAULT-HOSTNAME" { variable "FINAL-DEFAULT-HOSTNAME" { type = string description = "DB VSI Hostname" +} + +variable "REAL_HOSTNAME" { + type = string + description = "DB VSI Real Hostname" +} + +locals { + HANA_PROCESSING_TYPE = "All" + # HANA_PROCESSING_TYPE with accepted values: "All", "OLAP", "OLTP" "SAP Business One"- if needed for future development + ALL_HANA_CERTIFIED_STORAGE = jsondecode(file("${path.root}/files/hana_volume_layout.json")) + HANA_PROCESSING_TYPE_JSON = replace(trimspace(lower(local.HANA_PROCESSING_TYPE)), " ", "_") + PROCESSING_TYPE_FOUND = local.HANA_PROCESSING_TYPE_JSON == "all" ? true : contains(keys(local.ALL_HANA_CERTIFIED_STORAGE["profiles"]["${var.PROFILE}"]["processing_type"]), local.HANA_PROCESSING_TYPE_JSON) + OS_FROM_IMAGE = replace(replace(trimspace(lower(var.IMAGE)), "ibm-", ""), "/-amd64-sap-hana-.*/", "") + ALL_OS_TYPES = [] + OS_FOR_ALL_PROCESSING_TYPES = local.PROCESSING_TYPE_FOUND == true ? flatten([ for k in keys(local.ALL_HANA_CERTIFIED_STORAGE["profiles"]["${var.PROFILE}"]["processing_type"]) : concat(local.ALL_OS_TYPES, local.ALL_HANA_CERTIFIED_STORAGE["profiles"]["${var.PROFILE}"]["processing_type"]["${k}"])]) : [] + OS_TYPE_FOUND = local.PROCESSING_TYPE_FOUND == true ? (local.HANA_PROCESSING_TYPE_JSON == "all" ? contains(local.OS_FOR_ALL_PROCESSING_TYPES, "${lower(local.OS_FROM_IMAGE)}") : contains(local.ALL_HANA_CERTIFIED_STORAGE["profiles"]["${var.PROFILE}"]["processing_type"]["${local.HANA_PROCESSING_TYPE_JSON}"], "${lower(local.OS_FROM_IMAGE)}")) : false + CURRENT_STORAGE_CERTIFIED = local.PROCESSING_TYPE_FOUND == true && local.OS_TYPE_FOUND == true ? local.ALL_HANA_CERTIFIED_STORAGE.profiles["${var.PROFILE}"]["storage"]: null + # Define VOLUMES_STRUCTURE tuple for preserving the order of the elements in hash (to make sure the order for the elements in VOLUME_SIZES and VOL_PROFILE is the same) + VOLUMES_STRUCTURE = local.PROCESSING_TYPE_FOUND == true && local.OS_TYPE_FOUND == true ? flatten([ for k, v in local.CURRENT_STORAGE_CERTIFIED : v ]) : null + VOLUME_SIZES = local.PROCESSING_TYPE_FOUND == true && local.OS_TYPE_FOUND == true ? flatten([ for k in range(length(local.VOLUMES_STRUCTURE)) : [ [for _ in range(local.VOLUMES_STRUCTURE[k]["disk_count"]) : local.VOLUMES_STRUCTURE[k]["disk_size"]]]]) : [] + VOL_PROFILE = local.PROCESSING_TYPE_FOUND == true && local.OS_TYPE_FOUND == true ? flatten([ for k in range(length(local.VOLUMES_STRUCTURE)) : [ [for _ in range(local.VOLUMES_STRUCTURE[k]["disk_count"]) : local.VOLUMES_STRUCTURE[k]["iops"]]]]) : [] + DISPLAY_CRT_STORAGE = local.PROCESSING_TYPE_FOUND == true && local.OS_TYPE_FOUND == true ? { for k, v in local.CURRENT_STORAGE_CERTIFIED : k => { for j, m in v : j => m if j != "lvm" && j != "fs_type" && j != "mount_point" }} : null } \ No newline at end of file diff --git a/schematics/modules/db-vsi/volume.tf b/schematics/modules/db-vsi/volume.tf index de34219..353ca54 100644 --- a/schematics/modules/db-vsi/volume.tf +++ b/schematics/modules/db-vsi/volume.tf @@ -1,9 +1,8 @@ resource "ibm_is_volume" "vol" { - -count = length( var.VOLUME_SIZES ) - name = "${var.FINAL-DEFAULT-HOSTNAME}-vol${count.index}" + count = length( local.VOLUME_SIZES ) > 0 && length( local.VOLUME_SIZES ) == length( local.VOL_PROFILE ) ? length( local.VOLUME_SIZES ) : 0 + name = "${var.REAL_HOSTNAME}-vol${count.index}" zone = var.ZONE resource_group = data.ibm_resource_group.group.id - capacity = var.VOLUME_SIZES[count.index] - profile = var.VOL_PROFILE + capacity = local.VOLUME_SIZES[count.index] + profile = local.VOL_PROFILE[count.index] } \ No newline at end of file diff --git a/schematics/modules/db-vsi/vsi.tf b/schematics/modules/db-vsi/vsi.tf index 22b35d3..2696790 100644 --- a/schematics/modules/db-vsi/vsi.tf +++ b/schematics/modules/db-vsi/vsi.tf @@ -38,4 +38,11 @@ resource "ibm_is_instance" "vsi" { security_groups = [data.ibm_is_security_group.securitygroup.id] } volumes = ibm_is_volume.vol[*].id + lifecycle { + precondition { + condition = local.PROCESSING_TYPE_FOUND == true && local.OS_TYPE_FOUND == true + error_message = "The chosen storage PROFILE for HANA VSI \"${var.PROFILE}\" is not a certified storage profile for the selected OS IMAGE: \"${var.IMAGE}\". Please, chose the appropriate certified storage PROFILE for the HANA VSI from https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc . Make sure the selected PROFILE is certified for the selected OS type and for the proceesing type (SAP Business One, OLTP, OLAP)" + # error_message = "The chosen storage PROFILE for HANA VSI \"${var.PROFILE}\" is not a certified storage profile for processing type: \"${upper(local.HANA_PROCESSING_TYPE)}\" or for the selected OS IMAGE: \"${var.IMAGE}\". Please, chose the appropriate certified storage PROFILE for the HANA VSI from https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc . Make sure the selected PROFILE is certified for the selected OS type and for the proceesing type (SAP Business One, OLTP, OLAP)" + } + } } \ No newline at end of file diff --git a/schematics/modules/dns/dns_integration.tf b/schematics/modules/dns/dns_integration.tf index 857414b..31cb073 100644 --- a/schematics/modules/dns/dns_integration.tf +++ b/schematics/modules/dns/dns_integration.tf @@ -8,9 +8,9 @@ resource "local_file" "ha_ansible_dns-vars" { # DNS variables domain_name: "${var.DOMAIN_NAME}" -cname_ascs: "${var.ASCS-VIRT-HOSTNAME}" -cname_ers: "${var.ERS-VIRT-HOSTNAME}" -cname_hana: "${var.HANA-VIRT-HOSTNAME}" +cname_ascs: "${var.ASCS_VIRT_HOSTNAME}" +cname_ers: "${var.ERS_VIRT_HOSTNAME}" +cname_hana: "${var.HANA_VIRT_HOSTNAME}" ... DOC filename = "ansible/dns-vars.yml" diff --git a/schematics/modules/dns/dns_svcs.tf b/schematics/modules/dns/dns_svcs.tf index 8625ce5..dc60da9 100644 --- a/schematics/modules/dns/dns_svcs.tf +++ b/schematics/modules/dns/dns_svcs.tf @@ -17,7 +17,7 @@ resource "ibm_dns_resource_record" "cname-ascs" { instance_id = ibm_resource_instance.dns_inst.guid zone_id = ibm_dns_zone.ha_zone.zone_id type = "CNAME" - name = var.ASCS-VIRT-HOSTNAME + name = var.ASCS_VIRT_HOSTNAME rdata = "${var.ALB_ASCS_HOSTNAME}" ttl = 43200 } @@ -26,7 +26,7 @@ resource "ibm_dns_resource_record" "cname-ers" { instance_id = ibm_resource_instance.dns_inst.guid zone_id = ibm_dns_zone.ha_zone.zone_id type = "CNAME" - name = var.ERS-VIRT-HOSTNAME + name = var.ERS_VIRT_HOSTNAME rdata = "${var.ALB_ERS_HOSTNAME}" ttl = 43200 } @@ -35,7 +35,7 @@ resource "ibm_dns_resource_record" "cname-hana" { instance_id = ibm_resource_instance.dns_inst.guid zone_id = ibm_dns_zone.ha_zone.zone_id type = "CNAME" - name = var.HANA-VIRT-HOSTNAME + name = var.HANA_VIRT_HOSTNAME rdata = "${var.ALB_HANA_HOSTNAME}" ttl = 43200 } diff --git a/schematics/modules/dns/variables.tf b/schematics/modules/dns/variables.tf index 6c3e748..3e126aa 100644 --- a/schematics/modules/dns/variables.tf +++ b/schematics/modules/dns/variables.tf @@ -50,17 +50,17 @@ data "ibm_resource_group" "group" { name = var.RESOURCE_GROUP } -variable "ASCS-VIRT-HOSTNAME" { +variable "ASCS_VIRT_HOSTNAME" { type = string description = "Private SubDomain Name" } -variable "ERS-VIRT-HOSTNAME" { +variable "ERS_VIRT_HOSTNAME" { type = string description = "Private SubDomain Name" } -variable "HANA-VIRT-HOSTNAME" { +variable "HANA_VIRT_HOSTNAME" { type = string description = "Private SubDomain Name" } diff --git a/schematics/modules/file-shares/cache/mount_path.tmpl b/schematics/modules/file-shares/cache/mount_path.tmpl deleted file mode 100644 index 728d91d..0000000 --- a/schematics/modules/file-shares/cache/mount_path.tmpl +++ /dev/null @@ -1 +0,0 @@ -fsf-fra0451b-byok-fz.adn.networklayer.com:/949845d1_2fec_41dc_acca_9deb0f5f7a5a diff --git a/schematics/modules/file-shares/cleaning-up/delete_file_share.sh b/schematics/modules/file-shares/cleaning-up/delete_file_share.sh deleted file mode 100644 index 6b3ba63..0000000 --- a/schematics/modules/file-shares/cleaning-up/delete_file_share.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -########### - -echo 'Login to ibmcloud' -ibmcloud config --check-version=false -q --http-timeout 240 --color enable -ibmcloud login -r $region -g $resource_group_id --apikey $api_key -export oauth_token=$(ibmcloud iam oauth-tokens | awk '{print $4}') - -share_id=$(cat modules/file-shares/cleaning-up/share_id_$share_name.tmpl) - -curl -X DELETE "$vpc_api_endpoint/v1/shares/$share_id?version=2023-05-30&generation=2&maturity=beta" -H "Authorization: Bearer ${oauth_token}" \ No newline at end of file diff --git a/schematics/modules/file-shares/cleaning-up/delete_file_shares_mounts.sh b/schematics/modules/file-shares/cleaning-up/delete_file_shares_mounts.sh deleted file mode 100644 index 8c68bd2..0000000 --- a/schematics/modules/file-shares/cleaning-up/delete_file_shares_mounts.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -########### - -echo 'Login to ibmcloud' -ibmcloud config --check-version=false -q --http-timeout 240 --color enable -ibmcloud login -r $region -g $resource_group_id --apikey $api_key -export oauth_token=$(ibmcloud iam oauth-tokens | awk '{print $4}') - -share_id=$(cat modules/file-shares/cleaning-up/share_id_$share_name.tmpl) -mount_id=$(cat modules/file-shares/cleaning-up/mount_id_$share_name.tmpl) -curl -X DELETE "$vpc_api_endpoint/v1/shares/$share_id/mount_targets/$mount_id?version=2023-05-30&generation=2&maturity=beta" -H "Authorization: Bearer ${oauth_token}" \ No newline at end of file diff --git a/schematics/modules/file-shares/cleaning-up/fs_clean_up_operations.tf b/schematics/modules/file-shares/cleaning-up/fs_clean_up_operations.tf deleted file mode 100644 index 9d11d48..0000000 --- a/schematics/modules/file-shares/cleaning-up/fs_clean_up_operations.tf +++ /dev/null @@ -1,88 +0,0 @@ -########################### File Share Creation -################################################## - -resource "null_resource" "get_fs_ids" { - depends_on = [ null_resource.delete_file_shares_mounts ] - triggers = { - vpc_api_endpoint = local.vpc_api_endpoint - api_key = var.api_key - share_name = lower ("${var.prefix}-${var.sap_sid}") - region = var.region - share_size = var.share_size - share_profile = var.share_profile - var_timeout = var.var_timeout - zone = var.zone - resource_group_id = var.resource_group_id - } - - provisioner "local-exec" { - when = destroy - - command = "sleep ${self.triggers.var_timeout};export resource_group_id=${self.triggers.resource_group_id};export share_profile=${self.triggers.share_profile};export share_size=${self.triggers.share_size};export zone=${self.triggers.zone};export vpc_api_endpoint=${self.triggers.vpc_api_endpoint};export api_key=${self.triggers.api_key};export share_name=${self.triggers.share_name}; export region=${self.triggers.region}; chmod +x ${path.module}/get_fs_ids.sh;${path.module}/get_fs_ids.sh > ${path.module}/get_ids.log" - interpreter = ["/bin/bash", "-c"] - on_failure = continue - } - -} - -resource "null_resource" "delete_file_shares_mounts" { - depends_on = [ null_resource.delete_file_share ] - #count = 1 - triggers = { - vpc_api_endpoint = local.vpc_api_endpoint - api_key = var.api_key - share_name = lower ("${var.prefix}-${var.sap_sid}") - region = var.region - zone = var.zone - share_size = var.share_size - share_profile = var.share_profile - resource_group_id = var.resource_group_id - } - - provisioner "local-exec" { - when = destroy - - command = "export resource_group_id=${self.triggers.resource_group_id};export share_profile=${self.triggers.share_profile};export share_size=${self.triggers.share_size};export zone=${self.triggers.zone};export vpc_api_endpoint=${self.triggers.vpc_api_endpoint};export api_key=${self.triggers.api_key};export share_name=${self.triggers.share_name}; export region=${self.triggers.region};chmod +x ${path.module}/get_fs_ids.sh;${path.module}/get_fs_ids.sh ;chmod +x ${path.module}/delete_file_shares_mounts.sh; ${path.module}/delete_file_shares_mounts.sh > ${path.module}/dmfs.log" - interpreter = ["/bin/bash", "-c"] - } -} - -resource "null_resource" "delete_file_share" { - depends_on = [ null_resource.troubleshoot_fs_ids ] - #count = 1 - triggers = { - vpc_api_endpoint = local.vpc_api_endpoint - api_key = var.api_key - share_name = lower ("${var.prefix}-${var.sap_sid}") - region = var.region - resource_group_id = var.resource_group_id - } - - provisioner "local-exec" { - when = destroy - - command = "export resource_group_id=${self.triggers.resource_group_id};export vpc_api_endpoint=${self.triggers.vpc_api_endpoint};export api_key=${self.triggers.api_key};export share_name=${self.triggers.share_name}; export region=${self.triggers.region};chmod +x ${path.module}/delete_file_share.sh; ${path.module}/delete_file_share.sh > ${path.module}/dfs.log" - interpreter = ["/bin/bash", "-c"] - } -} - -resource "null_resource" "troubleshoot_fs_ids" { - triggers = { - vpc_api_endpoint = local.vpc_api_endpoint - api_key = var.api_key - share_name = lower ("${var.prefix}-${var.sap_sid}") - region = var.region - share_size = var.share_size - share_profile = var.share_profile - var_timeout = var.var_timeout - zone = var.zone - } - - provisioner "local-exec" { - when = destroy - - command = "cat ${path.module}/*.log" - interpreter = ["/bin/bash", "-c"] - } - -} \ No newline at end of file diff --git a/schematics/modules/file-shares/cleaning-up/get_fs_ids.sh b/schematics/modules/file-shares/cleaning-up/get_fs_ids.sh deleted file mode 100644 index c6b4e0b..0000000 --- a/schematics/modules/file-shares/cleaning-up/get_fs_ids.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -########### - -echo 'Login to ibmcloud' -ibmcloud config --check-version=false -q --http-timeout 240 --color enable -ibmcloud login -r $region -g $resource_group_id --apikey $api_key -export oauth_token=$(ibmcloud iam oauth-tokens | awk '{print $4}') - -export share_id=$(ibmcloud is share "$share_name" | awk '/ID/ {print $2}' | head -n 1) - -echo $share_id > modules/file-shares/cleaning-up/share_id_$share_name.tmpl - - -curl -X GET "$vpc_api_endpoint/v1/shares/$share_id/mount_targets?version=2023-05-30&generation=2&maturity=beta" \ - -H "Authorization: Bearer ${oauth_token}" \ - -H 'Content-Type: application/json' \ - -d '{ - "name": "'"$share_name"'", - "vpc": { - "id": "'"$vpc_id"'" - } - }' -o modules/file-shares/cleaning-up/output_fs_mt_$share_name.json - -export mount_id=$(grep -m 1 -o '"id":"[^"]*"' modules/file-shares/cleaning-up/output_fs_mt_$share_name.json | sed -n '1s/"id":"\(.*\)"/\1/p;q') -echo $mount_id > modules/file-shares/cleaning-up/mount_id_$share_name.tmpl diff --git a/schematics/modules/file-shares/cleaning-up/variables.tf b/schematics/modules/file-shares/cleaning-up/variables.tf deleted file mode 100644 index 04ee138..0000000 --- a/schematics/modules/file-shares/cleaning-up/variables.tf +++ /dev/null @@ -1,78 +0,0 @@ -/** -################################################################################################################# -* Variable Section for the Bastion Module. -* Start Here of the Variable Section -################################################################################################################# -*/ -variable "vpc_id" { - description = "Required parameter vpc_id" - type = string -} - -variable "vpc" { - description = "Required parameter vpc" - type = string -} - -variable "region" { - description = "Please enter a region from the following available region and zones mapping." - type = string - } - -variable "zone" { - description = "Availability Zone where bastion resource will be created" - type = string -} - -variable "resource_group_id" { - description = "Resource Group ID is used to separate the resources in a group." - type = string -} - -/* -data "local_file" "input" { - depends_on = [ null_resource.create_file_share ] - filename = "${path.module}/cache/mount_path.tmpl" -} -*/ - -locals { - share_name = lower ("${var.prefix}-${var.sap_sid}") - vpc_api_endpoint = "https://${var.region}.iaas.cloud.ibm.com" -# mount_path = chomp(data.local_file.input.content) -} - -variable "sap_sid" { - type = string - description = "SAP SID" -} - -variable "api_key" { - description = "Please enter the IBM Cloud API key." - type = string -} - -variable "prefix" { - description = "Prefix for all the resources." - type = string -} - -variable "ansible_var_name" { - description = "ansible_var_name for all the resources." - type = string -} - -variable "var_timeout" { - description = "ansible_var_name for all the resources." - type = string -} - -variable "share_size" { - description = "Specify the file share size. The value should be between 10 GB to 32000 GB's" - type = number -} - -variable "share_profile" { - description = "Enter the share profile value. The value should be tier-3iops, tier-5iops and tier-10iops" - type = string -} diff --git a/schematics/modules/file-shares/cleaning-up/versions.tf b/schematics/modules/file-shares/cleaning-up/versions.tf deleted file mode 100644 index 80a8bb9..0000000 --- a/schematics/modules/file-shares/cleaning-up/versions.tf +++ /dev/null @@ -1,19 +0,0 @@ -/** -################################################################################################################# -* Terraform Initialization for this Module and Version Specification -* Start of the Terraform Initialization Section -################################################################################################################# -**/ -terraform { - required_providers { - ibm = { - source = "IBM-Cloud/ibm" - } - } -} - -/** -################################################################################################################# -* End of the Terraform Initialization Section -################################################################################################################# -**/ diff --git a/schematics/modules/file-shares/create_file_share.sh b/schematics/modules/file-shares/create_file_share.sh deleted file mode 100644 index df2c9f3..0000000 --- a/schematics/modules/file-shares/create_file_share.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -########### -echo 'Login to ibmcloud' -ibmcloud config --check-version=false -q --http-timeout 240 --color enable -ibmcloud login -r $region -g $resource_group_id --apikey $api_key -export oauth_token=$(ibmcloud iam oauth-tokens | awk '{print $4}') - -curl -X POST "$vpc_api_endpoint/v1/shares?version=2023-05-30&generation=2&maturity=beta" \ - -H "Authorization: Bearer ${oauth_token}" \ - -H "Content-Type: application/json" \ - -d '{ - "size": '$share_size', - "name": "'"$share_name"'", - "profile": { - "name": "'"$share_profile"'" - }, - "zone": { - "name": "'"$zone"'" - }, - "resource_group": { - "id": "'"$resource_group_id"'" - } - }' -o modules/file-shares/cache/output_fs_$share_name.json - -share_id=$(grep -o "\"id\":\"[^\"]*\"" modules/file-shares/cache/output_fs_$share_name.json | sed 's/"id":"//' | awk -F\" 'NR==1 {print $1}') - -echo $share_id > modules/file-shares/cache/share_id_$share_name.tmpl - -sleep 40 - -curl -X POST "$vpc_api_endpoint/v1/shares/$share_id/mount_targets?version=2023-05-30&generation=2&maturity=beta" \ - -H "Authorization: Bearer ${oauth_token}" \ - -H 'Content-Type: application/json' \ - -d '{ - "name": "'"$share_name"'", - "vpc": { - "id": "'"$vpc_id"'" - } - }' -o modules/file-shares/cache/output_fs_mt_$share_name.json - -sleep 20 - -mount_path=$(grep -o '"mount_path":"[^"]*"' modules/file-shares/cache/output_fs_mt_$share_name.json | awk -F'"' '{print $4}') -echo $mount_path > modules/file-shares/cache/mount_path.tmpl - - -mount_id=$(grep -m 1 -o '"id":"[^"]*"' modules/file-shares/cache/output_fs_mt_$share_name.json | sed -n '1s/"id":"\(.*\)"/\1/p;q') -echo $mount_id > modules/file-shares/cache/mount_id_$share_name.tmpl \ No newline at end of file diff --git a/schematics/modules/file-shares/fs_operations.tf b/schematics/modules/file-shares/fs_operations.tf index 3048933..0ba57f8 100644 --- a/schematics/modules/file-shares/fs_operations.tf +++ b/schematics/modules/file-shares/fs_operations.tf @@ -1,14 +1,23 @@ ########################### File Share Creation ################################################## -resource "time_sleep" "wait_for_FS_api" { - create_duration = var.var_timeout +resource "ibm_is_share" "sap_fs" { + access_control_mode = "vpc" + zone = var.zone + resource_group = var.resource_group_id + size = var.share_size + name = local.share_name + profile = var.share_profile } -resource "null_resource" "create_file_share" { - depends_on = [ time_sleep.wait_for_FS_api ] - provisioner "local-exec" { - command = "export resource_group_id=${var.resource_group_id };export vpc_api_endpoint=${local.vpc_api_endpoint}; export vpc_id=${var.vpc_id};export region=${var.region};export api_key=${var.api_key};export share_size=${var.share_size};export share_name=${local.share_name};export share_profile=${var.share_profile};export zone=${var.zone}; chmod +x ${path.module}/create_file_share.sh; ${path.module}/create_file_share.sh > ${path.module}/cfs.log" - interpreter = ["/bin/bash", "-c"] - } +resource "ibm_is_share_mount_target" "mount_target_sap_fs" { + share = ibm_is_share.sap_fs.id + vpc = var.vpc_id + name = local.share_name +} + +data "ibm_is_share_mount_target" "data_mount_target_sap_fs" { + depends_on = [ ibm_is_share_mount_target.mount_target_sap_fs ] + share = ibm_is_share.sap_fs.id + mount_target = ibm_is_share_mount_target.mount_target_sap_fs.mount_target } \ No newline at end of file diff --git a/schematics/modules/file-shares/output.tf b/schematics/modules/file-shares/output.tf index 8afa41e..3fca912 100644 --- a/schematics/modules/file-shares/output.tf +++ b/schematics/modules/file-shares/output.tf @@ -6,10 +6,11 @@ ## Creating ansible file share vars. resource "local_file" "file_share-vars" { - depends_on = [ null_resource.create_file_share ] + depends_on = [ data.ibm_is_share_mount_target.data_mount_target_sap_fs ] + file_permission = "0644" content = <<-DOC ${var.ansible_var_name}_share_name: "${local.share_name}" - ${var.ansible_var_name}_mount_path: "${local.mount_path}" + ${var.ansible_var_name}_mount_path: "${data.ibm_is_share_mount_target.data_mount_target_sap_fs.mount_path}" DOC filename = "ansible/fileshare_${local.share_name}.yml" } \ No newline at end of file diff --git a/schematics/modules/file-shares/variables.tf b/schematics/modules/file-shares/variables.tf index 3082935..461d310 100644 --- a/schematics/modules/file-shares/variables.tf +++ b/schematics/modules/file-shares/variables.tf @@ -29,15 +29,8 @@ variable "resource_group_id" { type = string } -data "local_file" "input" { - depends_on = [ null_resource.create_file_share ] - filename = "${path.module}/cache/mount_path.tmpl" -} - locals { share_name = lower ("${var.prefix}-${var.sap_sid}") - vpc_api_endpoint = "https://${var.region}.iaas.cloud.ibm.com" - mount_path = chomp(data.local_file.input.content) } variable "sap_sid" { @@ -60,17 +53,12 @@ variable "ansible_var_name" { type = string } -variable "var_timeout" { - description = "ansible_var_name for all the resources." - type = string -} - variable "share_size" { description = "Specify the file share size. The value should be between 10 GB to 32000 GB's" type = number } variable "share_profile" { - description = "Enter the share profile value. The value should be tier-3iops, tier-5iops and tier-10iops" + description = "The profile for File Share Storage. Valid value: dp2." type = string -} +} \ No newline at end of file diff --git a/schematics/modules/precheck-ssh-exec/key-generation.tf b/schematics/modules/precheck-ssh-exec/key-generation.tf index 6b9fe80..4a20ff9 100644 --- a/schematics/modules/precheck-ssh-exec/key-generation.tf +++ b/schematics/modules/precheck-ssh-exec/key-generation.tf @@ -1,7 +1,7 @@ # Export Terraform variable values to a temp id_rsa file resource "local_file" "tf_id_rsa" { content = <<-DOC -${var.private_ssh_key} +${var.PRIVATE_SSH_KEY} DOC filename = "ansible/id_rsa" file_permission = "0600" diff --git a/schematics/modules/precheck-ssh-exec/precheck-remote-exec.tf b/schematics/modules/precheck-ssh-exec/precheck-remote-exec.tf index ff371a4..b915f1b 100644 --- a/schematics/modules/precheck-ssh-exec/precheck-remote-exec.tf +++ b/schematics/modules/precheck-ssh-exec/precheck-remote-exec.tf @@ -6,7 +6,7 @@ resource "null_resource" "check-bastion-resources" { type = "ssh" user = "root" host = var.BASTION_FLOATING_IP - private_key = var.private_ssh_key + private_key = var.PRIVATE_SSH_KEY timeout = "1m" } diff --git a/schematics/modules/precheck-ssh-exec/variables.tf b/schematics/modules/precheck-ssh-exec/variables.tf index 604d654..202b34d 100644 --- a/schematics/modules/precheck-ssh-exec/variables.tf +++ b/schematics/modules/precheck-ssh-exec/variables.tf @@ -8,7 +8,7 @@ variable "HOSTNAME" { description = "VSI Hostname" } -variable "private_ssh_key" { +variable "PRIVATE_SSH_KEY" { type = string description = "Private ssh key" } diff --git a/schematics/output.tf b/schematics/output.tf index 4fd550e..e156091 100644 --- a/schematics/output.tf +++ b/schematics/output.tf @@ -6,6 +6,12 @@ output "HANA-DB-PRIVATE-IP-VSI2" { value = "${data.ibm_is_instance.db-vsi-2.primary_network_interface[0].primary_ip[0].address}" } +output "HANA-STORAGE-LAYOUT" { + value = distinct([ + for stg in module.db-vsi : stg.STORAGE-LAYOUT + ])[0] +} + output "SAP-APP-PRIVATE-IP-VSI1" { value = "${data.ibm_is_instance.app-vsi-1.primary_network_interface[0].primary_ip[0].address}" } diff --git a/schematics/provider.tf b/schematics/provider.tf index 44e93a6..479c4c2 100644 --- a/schematics/provider.tf +++ b/schematics/provider.tf @@ -1,13 +1,13 @@ -variable "ibmcloud_api_key" { - description = "IBM Cloud API key" +variable "IBMCLOUD_API_KEY" { + description = "IBM Cloud API key (Sensitive* value)." sensitive = true validation { - condition = length(var.ibmcloud_api_key) > 43 #&& substr(var.ibmcloud_api_key, 14, 15) == "-" - error_message = "The ibmcloud_api_key value must be a valid IBM Cloud API key." + condition = length(var.IBMCLOUD_API_KEY) > 43 #&& substr(var.IBMCLOUD_API_KEY, 14, 15) == "-" + error_message = "The IBMCLOUD_API_KEY value must be a valid IBM Cloud API key." } } provider "ibm" { - ibmcloud_api_key = var.ibmcloud_api_key + ibmcloud_api_key = var.IBMCLOUD_API_KEY region = var.REGION } diff --git a/schematics/variables.tf b/schematics/variables.tf index 59137d6..78441c7 100644 --- a/schematics/variables.tf +++ b/schematics/variables.tf @@ -2,14 +2,14 @@ # The variables and data sources used in VPC infra Modules. ############################################################ -variable "private_ssh_key" { +variable "PRIVATE_SSH_KEY" { type = string - description = "Input id_rsa private key content" + description = "Input id_rsa private key content (Sensitive* value)." } variable "SSH_KEYS" { type = list(string) - description = "IBM Cloud SSH Keys ID list to access the VSIs" + description = "List of SSH Keys UUIDs that are allowed to SSH as root to the VSI. Can contain one or more IDs. The list of SSH Keys is available here: https://cloud.ibm.com/vpc-ext/compute/sshKeys." validation { condition = var.SSH_KEYS == [] ? false : true && var.SSH_KEYS == [""] ? false : true error_message = "At least one SSH KEY is needed to be able to access the VSI." @@ -18,18 +18,18 @@ variable "SSH_KEYS" { variable "BASTION_FLOATING_IP" { type = string - description = "Input the FLOATING IP from the Bastion Server" + description = "Input the FLOATING IP from the Bastion Server." } variable "RESOURCE_GROUP" { type = string - description = "EXISTING Resource Group for VPC Resources and File Shares" + description = "The name of an EXISTING Resource Group for VSIs and Volumes resources. Default value: \"Default\". The list of Resource Groups is available here: https://cloud.ibm.com/account/resource-groups." default = "Default" } variable "REGION" { type = string - description = "Cloud Region" + description = "The cloud region where to deploy the solution. The regions and zones for VPC are listed here:https://cloud.ibm.com/docs/containers?topic=containers-regions-and-zones#zones-vpc. Review supported locations in IBM Cloud Schematics here: https://cloud.ibm.com/docs/schematics?topic=schematics-locations." validation { condition = contains(["eu-de", "eu-gb", "us-south", "us-east"], var.REGION ) error_message = "The REGION must be one of: eu-de, eu-gb, us-south, us-east." @@ -38,7 +38,7 @@ variable "REGION" { variable "ZONE" { type = string - description = "Cloud Zone" + description = "The cloud zone where to deploy the solution." validation { condition = length(regexall("^(eu-de|eu-gb|us-south|us-east)-(1|2|3)$", var.ZONE)) > 0 error_message = "The ZONE is not valid." @@ -47,7 +47,7 @@ variable "ZONE" { variable "VPC" { type = string - description = "EXISTING VPC name" + description = "The name of an EXISTING VPC. The list of VPCs is available here: https://cloud.ibm.com/vpc-ext/network/vpcs." validation { condition = length(regexall("^([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$", var.VPC)) > 0 error_message = "The VPC name is not valid." @@ -56,7 +56,7 @@ variable "VPC" { variable "SUBNET" { type = string - description = "EXISTING Subnet name" + description = "The name of an EXISTING Subnet. The list of Subnets is available here: https://cloud.ibm.com/vpc-ext/network/subnets." validation { condition = length(regexall("^([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$", var.SUBNET)) > 0 error_message = "The SUBNET name is not valid." @@ -65,7 +65,7 @@ variable "SUBNET" { variable "SECURITY_GROUP" { type = string - description = "EXISTING Security group name" + description = "The name of an EXISTING Security group. The list of Security Groups is available here: https://cloud.ibm.com/vpc-ext/network/securityGroups." validation { condition = length(regexall("^([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$", var.SECURITY_GROUP)) > 0 error_message = "The SECURITY_GROUP name is not valid." @@ -74,7 +74,7 @@ variable "SECURITY_GROUP" { variable "DOMAIN_NAME" { type = string - description = "Private Domain Name" + description = "The Domain Name used for DNS and ALB. Duplicates are not allowed. The list with DNS resources can be searched here: https://cloud.ibm.com/resources." nullable = false default = "example.com" validation { @@ -84,144 +84,148 @@ variable "DOMAIN_NAME" { } locals { - ASCS-VIRT-HOSTNAME = "sap${var.sap_sid}ascs" - ERS-VIRT-HOSTNAME = "sap${var.sap_sid}ers" - HANA-VIRT-HOSTNAME = "db${var.hana_sid}hana" + ASCS_VIRT_HOSTNAME = "sap${var.SAP_SID}ascs" + ERS_VIRT_HOSTNAME = "sap${var.SAP_SID}ers" + HANA_VIRT_HOSTNAME = "db${var.HANA_SID}hana" } -variable "ASCS-VIRT-HOSTNAME" { +variable "ASCS_VIRT_HOSTNAME" { type = string - description = "ASCS Virtual hostname​" + description = "ASCS Virtual hostname." nullable = false default = "sapascs" validation { - condition = length(var.ASCS-VIRT-HOSTNAME) > 2 && length (regex("^[a-z]*||^[0-9]*", var.ASCS-VIRT-HOSTNAME)) > 0 && length (regexall("[\\&]|[\\%]|[\\!]|[\\@]|[\\#]|[\\*]|[\\^]", var.ASCS-VIRT-HOSTNAME)) == 0 + condition = length(var.ASCS_VIRT_HOSTNAME) > 2 && length (regex("^[a-z]*||^[0-9]*", var.ASCS_VIRT_HOSTNAME)) > 0 && length (regexall("[\\&]|[\\%]|[\\!]|[\\@]|[\\#]|[\\*]|[\\^]", var.ASCS_VIRT_HOSTNAME)) == 0 error_message = "The SUBDOMAIN_NAME variable should not be empty and no special chars are allowed." } } output VIRT-HOSTNAME-ASCS { - value = var.ASCS-VIRT-HOSTNAME != "sapascs" ? var.ASCS-VIRT-HOSTNAME : lower ("${local.ASCS-VIRT-HOSTNAME}") + value = var.ASCS_VIRT_HOSTNAME != "sapascs" ? var.ASCS_VIRT_HOSTNAME : lower ("${local.ASCS_VIRT_HOSTNAME}") } -variable "ERS-VIRT-HOSTNAME" { +variable "ERS_VIRT_HOSTNAME" { type = string - description = "ERS Virtual hostname" + description = "ERS Virtual hostname." nullable = false default = "sapers" validation { - condition = length(var.ERS-VIRT-HOSTNAME) > 2 && length (regex("^[a-z]*||^[0-9]*", var.ERS-VIRT-HOSTNAME)) > 0 && length (regexall("[\\&]|[\\%]|[\\!]|[\\@]|[\\#]|[\\*]|[\\^]", var.ERS-VIRT-HOSTNAME)) == 0 + condition = length(var.ERS_VIRT_HOSTNAME) > 2 && length (regex("^[a-z]*||^[0-9]*", var.ERS_VIRT_HOSTNAME)) > 0 && length (regexall("[\\&]|[\\%]|[\\!]|[\\@]|[\\#]|[\\*]|[\\^]", var.ERS_VIRT_HOSTNAME)) == 0 error_message = "The SUBDOMAIN_NAME variable should not be empty and no special chars are allowed." } } output VIRT-HOSTNAME-ERS { - value = var.ERS-VIRT-HOSTNAME != "sapers" ? var.ERS-VIRT-HOSTNAME : lower ("${local.ERS-VIRT-HOSTNAME}") + value = var.ERS_VIRT_HOSTNAME != "sapers" ? var.ERS_VIRT_HOSTNAME : lower ("${local.ERS_VIRT_HOSTNAME}") } -variable "HANA-VIRT-HOSTNAME" { +variable "HANA_VIRT_HOSTNAME" { type = string - description = "HANA Virtual hostname" + description = "HANA Virtual hostname." nullable = false default = "dbhana" validation { - condition = length(var.HANA-VIRT-HOSTNAME) > 2 && length (regex("^[a-z]*||^[0-9]*", var.HANA-VIRT-HOSTNAME)) > 0 && length (regexall("[\\&]|[\\%]|[\\!]|[\\@]|[\\#]|[\\*]|[\\^]", var.HANA-VIRT-HOSTNAME)) == 0 + condition = length(var.HANA_VIRT_HOSTNAME) > 2 && length (regex("^[a-z]*||^[0-9]*", var.HANA_VIRT_HOSTNAME)) > 0 && length (regexall("[\\&]|[\\%]|[\\!]|[\\@]|[\\#]|[\\*]|[\\^]", var.HANA_VIRT_HOSTNAME)) == 0 error_message = "The SUBDOMAIN_NAME variable should not be empty and no special chars are allowed." } } output VIRT-HOSTNAME-HANA { - value = var.HANA-VIRT-HOSTNAME != "dbhana" ? var.HANA-VIRT-HOSTNAME : lower ("${local.HANA-VIRT-HOSTNAME}") + value = var.HANA_VIRT_HOSTNAME != "dbhana" ? var.HANA_VIRT_HOSTNAME : lower ("${local.HANA_VIRT_HOSTNAME}") } locals { - DB-HOSTNAME-1 = "hanadb-${var.hana_sid}-1" - DB-HOSTNAME-2 = "hanadb-${var.hana_sid}-2" - APP-HOSTNAME-1 = "sapapp-${var.sap_sid}-1" - APP-HOSTNAME-2 = "sapapp-${var.sap_sid}-2" + DB_HOSTNAME_1 = "hanadb-${var.HANA_SID}-1" + DB_HOSTNAME_2 = "hanadb-${var.HANA_SID}-2" + APP_HOSTNAME_1 = "sapapp-${var.SAP_SID}-1" + APP_HOSTNAME_2 = "sapapp-${var.SAP_SID}-2" } -variable "DB-PROFILE" { +variable "DB_PROFILE" { type = string - description = "DB VSI Profile" + description = "DB VSI Profile. The certified profiles for SAP HANA in IBM VPC: https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc" default = "mx2-16x128" + validation { + condition = contains(keys(jsondecode(file("files/hana_volume_layout.json")).profiles), "${var.DB_PROFILE}") + error_message = "The chosen storage PROFILE for HANA VSI \"${var.DB_PROFILE}\" is not a certified storage profile. Please, chose the appropriate certified storage PROFILE for the HANA VSI from https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc . Make sure the selected PROFILE is certified for the selected OS type and for the proceesing type (SAP Business One, OLTP, OLAP)" + } } -variable "DB-IMAGE" { +variable "DB_IMAGE" { type = string - description = "DB VSI OS Image" + description = "The OS image used for the HANA/APP VSI. You must use the Red Hat Enterprise Linux 8 for SAP HANA (amd64) image for all VMs as this image contains the required SAP and HA subscriptions. A list of images is available here: https://cloud.ibm.com/docs/vpc?topic=vpc-about-images." default = "ibm-redhat-8-6-amd64-sap-hana-2" } -variable "DB-HOSTNAME-1" { +variable "DB_HOSTNAME_1" { type = string - description = "DB VSI Hostname-1. \n Obs.: With the default value, the output is dynamically based on like this: \"hanadb-$your_hana_sid-1\"" + description = "SAP HANA Cluster VSI Hostnames - DB VSI Hostname-1. \n Obs: With the default value, the output is dynamically based on ." default = "hanadb-1" validation { - condition = length(var.DB-HOSTNAME-1) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.DB-HOSTNAME-1)) > 0 + condition = length(var.DB_HOSTNAME_1) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.DB_HOSTNAME_1)) > 0 error_message = "The DB-HOSTNAME is not valid." } } output HANA-DB-HOSTNAME-VSI1 { - value = var.DB-HOSTNAME-1 != "hanadb-1" ? var.DB-HOSTNAME-1 : lower ("${local.DB-HOSTNAME-1}") + value = var.DB_HOSTNAME_1 != "hanadb-1" ? var.DB_HOSTNAME_1 : lower ("${local.DB_HOSTNAME_1}") } -variable "DB-HOSTNAME-2" { +variable "DB_HOSTNAME_2" { type = string - description = "DB VSI Hostname-2. \n Obs.: With the default value, the output is dynamically based on like this: \"hanadb-$your_hana_sid-2\"" + description = "SAP HANA Cluster VSI Hostnames - DB VSI Hostname-2. \n Obs: With the default value, the output is dynamically based on ." default = "hanadb-2" nullable = true validation { - condition = length(var.DB-HOSTNAME-2) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.DB-HOSTNAME-2)) > 0 + condition = length(var.DB_HOSTNAME_2) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.DB_HOSTNAME_2)) > 0 error_message = "The DB-HOSTNAME is not valid." } } output HANA-DB-HOSTNAME-VSI2 { - value = var.DB-HOSTNAME-2 != "hanadb-2" ? var.DB-HOSTNAME-2 : lower ("${local.DB-HOSTNAME-2}") + value = var.DB_HOSTNAME_2 != "hanadb-2" ? var.DB_HOSTNAME_2 : lower ("${local.DB_HOSTNAME_2}") } -variable "APP-PROFILE" { +variable "APP_PROFILE" { type = string - description = "VSI Profile" + description = "The profile used for the APP VSI. A list of profiles is available here: https://cloud.ibm.com/docs/vpc?topic=vpc-profiles. For more information, check SAP Note 2927211: \"SAP Applications on IBM Virtual Private Cloud\"." default = "bx2-4x16" } -variable "APP-IMAGE" { +variable "APP_IMAGE" { type = string - description = "VSI OS Image" + description = "The OS image used for the APP VSI. You must use the Red Hat Enterprise Linux 8 for SAP HANA (amd64) image for all VMs as this image contains the required SAP and HA subscriptions. A list of images is available here: https://cloud.ibm.com/docs/vpc?topic=vpc-about-images." default = "ibm-redhat-8-6-amd64-sap-hana-2" } -variable "APP-HOSTNAME-1" { +variable "APP_HOSTNAME_1" { type = string - description = "APP VSI Hostname-1. \n Obs.: With the default value, the output is dynamically based on like this: \"sapapp-$your_sap_sid-1\"" + description = "SAP APP Cluster VSI Hostnames - APP VSI Hostname-1. \n Obs: With the default value, the output is dynamically based on ." default = "sapapp-1" validation { - condition = length(var.APP-HOSTNAME-1) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.APP-HOSTNAME-1)) > 0 + condition = length(var.APP_HOSTNAME_1) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.APP_HOSTNAME_1)) > 0 error_message = "The APP-HOSTNAME is not valid." } } output SAP-APP-HOSTNAME-VSI1 { - value = var.APP-HOSTNAME-1 != "sapapp-1" ? var.APP-HOSTNAME-1 : lower ("${local.APP-HOSTNAME-1}") + value = var.APP_HOSTNAME_1 != "sapapp-1" ? var.APP_HOSTNAME_1 : lower ("${local.APP_HOSTNAME_1}") } -variable "APP-HOSTNAME-2" { +variable "APP_HOSTNAME_2" { type = string - description = "APP VSI Hostname-2. \n Obs.: With the default value, the output is dynamically based on like this: \"sapapp-$your_sap_sid-2\"" + description = "SAP APP Cluster VSI Hostnames - APP VSI Hostname-2. \n Obs: With the default value, the output is dynamically based on ." default = "sapapp-2" nullable = true validation { - condition = length(var.APP-HOSTNAME-2) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.APP-HOSTNAME-2)) > 0 + condition = length(var.APP_HOSTNAME_2) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.APP_HOSTNAME_2)) > 0 error_message = "The APP-HOSTNAME is not valid." } } output SAP-APP-HOSTNAME-VSI2 { - value = var.APP-HOSTNAME-2 != "sapapp-2" ? var.APP-HOSTNAME-2 : lower ("${local.APP-HOSTNAME-2}") + value = var.APP_HOSTNAME_2 != "sapapp-2" ? var.APP_HOSTNAME_2 : lower ("${local.APP_HOSTNAME_2}") } locals { @@ -232,41 +236,41 @@ locals { data "ibm_is_lb" "alb-ascs" { depends_on = [module.alb-prereq] - name = lower ("${local.SAP-ALB-ASCS}-${var.sap_sid}") + name = lower ("${local.SAP-ALB-ASCS}-${var.SAP_SID}") } data "ibm_is_lb" "alb-ers" { depends_on = [module.alb-prereq] - name = lower ("${local.SAP-ALB-ERS}-${var.sap_sid}") + name = lower ("${local.SAP-ALB-ERS}-${var.SAP_SID}") } data "ibm_is_lb" "alb-hana" { depends_on = [module.alb-prereq] - name = lower ("${local.DB-ALB-HANA}-${var.hana_sid}") + name = lower ("${local.DB-ALB-HANA}-${var.HANA_SID}") } data "ibm_is_instance" "app-vsi-1" { depends_on = [module.app-vsi] - name = var.APP-HOSTNAME-1 != "sapapp-1" ? var.APP-HOSTNAME-1 : lower ("${local.APP-HOSTNAME-1}") + name = var.APP_HOSTNAME_1 != "sapapp-1" ? var.APP_HOSTNAME_1 : lower ("${local.APP_HOSTNAME_1}") } data "ibm_is_instance" "app-vsi-2" { depends_on = [module.app-vsi] - name = var.APP-HOSTNAME-2 != "sapapp-2" ? var.APP-HOSTNAME-2 : lower ("${local.APP-HOSTNAME-2}") + name = var.APP_HOSTNAME_2 != "sapapp-2" ? var.APP_HOSTNAME_2 : lower ("${local.APP_HOSTNAME_2}") } data "ibm_is_instance" "db-vsi-1" { depends_on = [module.db-vsi] - name = var.DB-HOSTNAME-1 != "hanadb-1" ? var.DB-HOSTNAME-1 : lower ("${local.DB-HOSTNAME-1}") + name = var.DB_HOSTNAME_1 != "hanadb-1" ? var.DB_HOSTNAME_1 : lower ("${local.DB_HOSTNAME_1}") } data "ibm_is_instance" "db-vsi-2" { depends_on = [module.db-vsi] - name = var.DB-HOSTNAME-2 != "hanadb-2" ? var.DB-HOSTNAME-2 : lower ("${local.DB-HOSTNAME-2}") + name = var.DB_HOSTNAME_2 != "hanadb-2" ? var.DB_HOSTNAME_2 : lower ("${local.DB_HOSTNAME_2}") } ############################################################ -# The variables and data sources used in File_Shares Module. +# The variables and data sources used in File_Share Module. ############################################################ data "ibm_is_vpc" "vpc" { @@ -277,50 +281,50 @@ data "ibm_resource_group" "group" { name = var.RESOURCE_GROUP } -variable "share_profile" { - description = "Enter the IOPs (IOPS per GB) tier for File Share storage. Valid values are: dp2, tier-3iops, tier-5iops, tier-10iops." +variable "SHARE_PROFILE" { + description = "The File Share Profile Storage. For more details see: https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles&interface=ui#dp2-profile." type = string - default = "tier-5iops" + default = "dp2" } -variable "usrsap-as1" { - description = "FS Size in GB for usrsap-as1" +variable "USRSAP_AS1" { + description = "File Share Size in GB for USRSAP_AS1" type = number default = 20 } -variable "usrsap-as2" { - description = "FS Size in GB for usrsap-as2" +variable "USRSAP_AS2" { + description = "File Share Size in GB for USRSAP_AS2" type = number default = 20 } -variable "usrsap-sapascs" { - description = "FS Size in GB for usrsap-sapascs" +variable "USRSAP_SAPASCS" { + description = "File Share Size in GB for USRSAP_SAPASCS" type = number default = 20 } -variable "usrsap-sapers" { - description = "FS Size in GB for usrsap-sapers" +variable "USRSAP_SAPERS" { + description = "File Share Size in GB for USRSAP_SAPERS" type = number default = 20 } -variable "usrsap-sapmnt" { - description = "FS Size in GB for usrsap-sapmnt" +variable "USRSAP_SAPMNT" { + description = "File Share Size in GB for USRSAP_SAPMNT" type = number default = 20 } -variable "usrsap-sapsys" { - description = "FS Size in GB for usrsap-sapsys" +variable "USRSAP_SAPSYS" { + description = "File Share Size in GB for USRSAP_SAPSYS" type = number default = 20 } -variable "usrsap-trans" { - description = "FS Size in GB for usrsap-trans" +variable "USRSAP_TRANS" { + description = "File Share Size in GB for USRSAP_TRANS" type = number default = 80 } @@ -329,192 +333,192 @@ variable "usrsap-trans" { # The variables and data sources used in SAP Ansible Modules. ############################################################## -variable "hana_sid" { +variable "HANA_SID" { type = string - description = "hana_sid" + description = "The SAP system ID identifies the SAP HANA system." default = "HDB" validation { - condition = length(regexall("^[a-zA-Z][a-zA-Z0-9][a-zA-Z0-9]$", var.hana_sid)) > 0 && !contains(["ADD", "ALL", "AMD", "AND", "ANY", "ARE", "ASC", "AUX", "AVG", "BIT", "CDC", "COM", "CON", "DBA", "END", "EPS", "FOR", "GET", "GID", "IBM", "INT", "KEY", "LOG", "LPT", "MAP", "MAX", "MIN", "MON", "NIX", "NOT", "NUL", "OFF", "OLD", "OMS", "OUT", "PAD", "PRN", "RAW", "REF", "ROW", "SAP", "SET", "SGA", "SHG", "SID", "SQL", "SUM", "SYS", "TMP", "TOP", "UID", "USE", "USR", "VAR"], var.hana_sid) - error_message = "The hana_sid is not valid." + condition = length(regexall("^[a-zA-Z][a-zA-Z0-9][a-zA-Z0-9]$", var.HANA_SID)) > 0 && !contains(["ADD", "ALL", "AMD", "AND", "ANY", "ARE", "ASC", "AUX", "AVG", "BIT", "CDC", "COM", "CON", "DBA", "END", "EPS", "FOR", "GET", "GID", "IBM", "INT", "KEY", "LOG", "LPT", "MAP", "MAX", "MIN", "MON", "NIX", "NOT", "NUL", "OFF", "OLD", "OMS", "OUT", "PAD", "PRN", "RAW", "REF", "ROW", "SAP", "SET", "SGA", "SHG", "SID", "SQL", "SUM", "SYS", "TMP", "TOP", "UID", "USE", "USR", "VAR"], var.HANA_SID) + error_message = "The HANA_SID is not valid." } } -variable "sap_ascs_instance_number" { +variable "SAP_ASCS_INSTANCE_NUMBER" { type = string - description = "sap_ascs_instance_number" + description = "Technical identifier for internal processes of ASCS." default = "00" validation { - condition = var.sap_ascs_instance_number >= 0 && var.sap_ascs_instance_number <=97 - error_message = "The sap_ascs_instance_number is not valid." + condition = var.SAP_ASCS_INSTANCE_NUMBER >= 0 && var.SAP_ASCS_INSTANCE_NUMBER <=97 + error_message = "The SAP_ASCS_INSTANCE_NUMBER is not valid." } } -variable "sap_ers_instance_number" { +variable "SAP_ERS_INSTANCE_NUMBER" { type = string - description = "sap_ers_instance_number" + description = "Technical identifier for internal processes of ERS." default = "01" validation { - condition = var.sap_ers_instance_number >= 00 && var.sap_ers_instance_number <=99 - error_message = "The sap_ers_instance_number is not valid." + condition = var.SAP_ERS_INSTANCE_NUMBER >= 00 && var.SAP_ERS_INSTANCE_NUMBER <=99 + error_message = "The SAP_ERS_INSTANCE_NUMBER is not valid." } } -variable "sap_ci_instance_number" { +variable "SAP_CI_INSTANCE_NUMBER" { type = string - description = "sap_ci_instance_number" + description = "Technical identifier for internal processes of PAS." default = "10" validation { - condition = var.sap_ci_instance_number >= 00 && var.sap_ci_instance_number <=99 - error_message = "The sap_ci_instance_number is not valid." + condition = var.SAP_CI_INSTANCE_NUMBER >= 00 && var.SAP_CI_INSTANCE_NUMBER <=99 + error_message = "The SAP_CI_INSTANCE_NUMBER is not valid." } } -variable "sap_aas_instance_number" { +variable "SAP_AAS_INSTANCE_NUMBER" { type = string - description = "sap_aas_instance_number" + description = "Technical identifier for internal processes of AAS." default = "20" validation { - condition = var.sap_aas_instance_number >= 00 && var.sap_aas_instance_number <=99 - error_message = "The sap_aas_instance_number is not valid." + condition = var.SAP_AAS_INSTANCE_NUMBER >= 00 && var.SAP_AAS_INSTANCE_NUMBER <=99 + error_message = "The SAP_AAS_INSTANCE_NUMBER is not valid." } } -variable "hana_sysno" { +variable "HANA_SYSNO" { type = string - description = "hana_sysno" + description = "Specifies the instance number of the SAP HANA system." default = "00" validation { - condition = var.hana_sysno >= 0 && var.hana_sysno <=97 - error_message = "The hana_sysno is not valid." + condition = var.HANA_SYSNO >= 0 && var.HANA_SYSNO <=97 + error_message = "The HANA_SYSNO is not valid." } } -variable "hana_main_password" { +variable "HANA_MAIN_PASSWORD" { type = string sensitive = true - description = "HANADB main password" + description = "Common password for all users that are created during the installation." validation { - condition = length(regexall("^(.{0,7}|.{15,}|[^0-9a-zA-Z]*)$", var.hana_main_password)) == 0 && length(regexall("^[^0-9_][0-9a-zA-Z!@#$_]+$", var.hana_main_password)) > 0 - error_message = "The hana_main_password is not valid." + condition = length(regexall("^(.{0,7}|.{15,}|[^0-9a-zA-Z]*)$", var.HANA_MAIN_PASSWORD)) == 0 && length(regexall("^[^0-9_][0-9a-zA-Z!@#$_]+$", var.HANA_MAIN_PASSWORD)) > 0 + error_message = "The HANA_MAIN_PASSWORD is not valid." } } -variable "hana_system_usage" { +variable "HANA_SYSTEM_USAGE" { type = string - description = "hana_system_usage" + description = "System Usage. Default: \"custom\". Valid values: \"production\", \"test\", \"development\", \"custom\"." default = "custom" validation { - condition = contains(["production", "test", "development", "custom" ], var.hana_system_usage ) - error_message = "The hana_system_usage must be one of: production, test, development, custom." + condition = contains(["production", "test", "development", "custom" ], var.HANA_SYSTEM_USAGE ) + error_message = "The HANA_SYSTEM_USAGE must be one of: production, test, development, custom." } } -variable "hana_components" { +variable "HANA_COMPONENTS" { type = string - description = "hana_components" + description = "SAP HANA Components. Default: \"server\". Valid values: \"all\", \"client\", \"es\", \"ets\", \"lcapps\", \"server\", \"smartda\", \"streaming\", \"rdsync\", \"xs\", \"studio\", \"afl\", \"sca\", \"sop\", \"eml\", \"rme\", \"rtl\", \"trp\"." default = "server" validation { - condition = contains(["all", "client", "es", "ets", "lcapps", "server", "smartda", "streaming", "rdsync", "xs", "studio", "afl", "sca", "sop", "eml", "rme", "rtl", "trp" ], var.hana_components ) - error_message = "The hana_components must be one of: all, client, es, ets, lcapps, server, smartda, streaming, rdsync, xs, studio, afl, sca, sop, eml, rme, rtl, trp." + condition = contains(["all", "client", "es", "ets", "lcapps", "server", "smartda", "streaming", "rdsync", "xs", "studio", "afl", "sca", "sop", "eml", "rme", "rtl", "trp" ], var.HANA_COMPONENTS ) + error_message = "The HANA_COMPONENTS must be one of: all, client, es, ets, lcapps, server, smartda, streaming, rdsync, xs, studio, afl, sca, sop, eml, rme, rtl, trp." } } -variable "kit_saphana_file" { +variable "KIT_SAPHANA_FILE" { type = string - description = "kit_saphana_file" + description = "Path to SAP HANA ZIP file, as downloaded from SAP Support Portal." default = "/storage/HANADB/51055299.ZIP" } -variable "sap_sid" { +variable "SAP_SID" { type = string - description = "sap_sid" + description = "The SAP system ID identifies the entire SAP system." default = "S4A" validation { - condition = length(regexall("^[a-zA-Z][a-zA-Z0-9][a-zA-Z0-9]$", var.sap_sid)) > 0 && !contains(["ADD", "ALL", "AMD", "AND", "ANY", "ARE", "ASC", "AUX", "AVG", "BIT", "CDC", "COM", "CON", "DBA", "END", "EPS", "FOR", "GET", "GID", "IBM", "INT", "KEY", "LOG", "LPT", "MAP", "MAX", "MIN", "MON", "NIX", "NOT", "NUL", "OFF", "OLD", "OMS", "OUT", "PAD", "PRN", "RAW", "REF", "ROW", "SAP", "SET", "SGA", "SHG", "SID", "SQL", "SUM", "SYS", "TMP", "TOP", "UID", "USE", "USR", "VAR"], var.sap_sid) - error_message = "The sap_sid is not valid." + condition = length(regexall("^[a-zA-Z][a-zA-Z0-9][a-zA-Z0-9]$", var.SAP_SID)) > 0 && !contains(["ADD", "ALL", "AMD", "AND", "ANY", "ARE", "ASC", "AUX", "AVG", "BIT", "CDC", "COM", "CON", "DBA", "END", "EPS", "FOR", "GET", "GID", "IBM", "INT", "KEY", "LOG", "LPT", "MAP", "MAX", "MIN", "MON", "NIX", "NOT", "NUL", "OFF", "OLD", "OMS", "OUT", "PAD", "PRN", "RAW", "REF", "ROW", "SAP", "SET", "SGA", "SHG", "SID", "SQL", "SUM", "SYS", "TMP", "TOP", "UID", "USE", "USR", "VAR"], var.SAP_SID) + error_message = "The SAP_SID is not valid." } } -variable "sap_main_password" { +variable "SAP_MAIN_PASSWORD" { type = string sensitive = true - description = "SAP main password" + description = "Common password for all users that are created during the installation." validation { - condition = length(regexall("^(.{0,9}|.{15,}|[^0-9]*)$", var.sap_main_password)) == 0 && length(regexall("^[^0-9_][0-9a-zA-Z@#$_]+$", var.sap_main_password)) > 0 - error_message = "The sap_main_password is not valid." + condition = length(regexall("^(.{0,9}|.{15,}|[^0-9]*)$", var.SAP_MAIN_PASSWORD)) == 0 && length(regexall("^[^0-9_][0-9a-zA-Z@#$_]+$", var.SAP_MAIN_PASSWORD)) > 0 + error_message = "The SAP_MAIN_PASSWORD is not valid." } } -variable "ha_password" { +variable "HA_PASSWORD" { type = string sensitive = true - description = "HA cluster password" + description = "HA cluster password." validation { - condition = length(regexall("^(.{0,9}|.{15,}|[^0-9]*)$", var.ha_password)) == 0 && length(regexall("^[^0-9_][0-9a-zA-Z@#$_]+$", var.ha_password)) > 0 - error_message = "The ha_password is not valid." + condition = length(regexall("^(.{0,9}|.{15,}|[^0-9]*)$", var.HA_PASSWORD)) == 0 && length(regexall("^[^0-9_][0-9a-zA-Z@#$_]+$", var.HA_PASSWORD)) > 0 + error_message = "The HA_PASSWORD is not valid." } } -variable "hdb_concurrent_jobs" { +variable "HDB_CONCURRENT_JOBS" { type = string - description = "hdb_concurrent_jobs" + description = "Number of concurrent jobs used to load and/or extract archives to HANA Host." default = "23" validation { - condition = var.hdb_concurrent_jobs >= 1 && var.hdb_concurrent_jobs <=25 - error_message = "The hdb_concurrent_jobs is not valid." + condition = var.HDB_CONCURRENT_JOBS >= 1 && var.HDB_CONCURRENT_JOBS <=25 + error_message = "The HDB_CONCURRENT_JOBS is not valid." } } -variable "kit_sapcar_file" { +variable "KIT_SAPCAR_FILE" { type = string - description = "kit_sapcar_file" + description = "Path to sapcar binary, as downloaded from SAP Support Portal." default = "/storage/S4HANA/SAPCAR_1010-70006178.EXE" } -variable "kit_swpm_file" { +variable "KIT_SWPM_FILE" { type = string - description = "kit_swpm_file" + description = "Path to SWPM archive (SAR), as downloaded from SAP Support Portal." default = "/storage/S4HANA/SWPM20SP13_1-80003424.SAR" } -variable "kit_sapexe_file" { +variable "KIT_SAPEXE_FILE" { type = string - description = "kit_sapexe_file" + description = "Path to SAP Kernel OS archive (SAR), as downloaded from SAP Support Portal." default = "/storage/S4HANA/SAPEXE_100-70005283.SAR" } -variable "kit_sapexedb_file" { +variable "KIT_SAPEXEDB_FILE" { type = string - description = "kit_sapexedb_file" + description = "Path to SAP Kernel DB archive (SAR), as downloaded from SAP Support Portal." default = "/storage/S4HANA/SAPEXEDB_100-70005282.SAR" } -variable "kit_igsexe_file" { +variable "KIT_IGSEXE_FILE" { type = string - description = "kit_igsexe_file" + description = "Path to IGS archive (SAR), as downloaded from SAP Support Portal." default = "/storage/S4HANA/igsexe_1-70005417.sar" } -variable "kit_igshelper_file" { +variable "KIT_IGSHELPER_FILE" { type = string - description = "kit_igshelper_file" + description = "Path to IGS Helper archive (SAR), as downloaded from SAP Support Portal." default = "/storage/S4HANA/igshelper_17-10010245.sar" } -variable "kit_saphotagent_file" { +variable "KIT_SAPHOSTAGENT_FILE" { type = string - description = "kit_saphotagent_file" + description = "Path to SAP Host Agent archive (SAR), as downloaded from SAP Support Portal." default = "/storage/S4HANA/SAPHOSTAGENT51_51-20009394.SAR" } -variable "kit_hdbclient_file" { +variable "KIT_HDBCLIENT_FILE" { type = string - description = "kit_hdbclient_file" + description = "Path to HANA DB client archive (SAR), as downloaded from SAP Support Portal." default = "/storage/S4HANA/IMDB_CLIENT20_009_28-80002082.SAR" } -variable "kit_s4hana_export" { +variable "KIT_S4HANA_EXPORT" { type = string - description = "kit_s4hana_export" + description = "Path to S/4HANA Installation Export dir. The archives downloaded from SAP Support Portal should be present in this path." default = "/storage/S4HANA/export" }