Skip to content

Commit

Permalink
v1.0.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis CI User committed Jun 20, 2023
1 parent 3d626d3 commit a173ba8
Show file tree
Hide file tree
Showing 37 changed files with 751 additions and 525 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ DB-HOSTNAME-2 = "hanadb-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-IMAGE = "ibm-redhat-8-4-amd64-sap-hana-4"
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"
Expand All @@ -154,7 +154,7 @@ APP-HOSTNAME-2 = "sapapp-2"
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-4-amd64-sap-hana-4"
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"
Expand Down Expand Up @@ -200,9 +200,7 @@ hana_components = "server"

kit_saphana_file = "/storage/HANADB/51055299.ZIP"
# SAP HANA Installation kit path
# Supported SAP HANA versions on Red Hat 8.4 and Suse 15.3: HANA 2.0 SP 5 Rev 57, kit file: 51055299.ZIP
# Supported SAP HANA versions on Red Hat 7.6: HANA 2.0 SP 5 Rev 52, kit file: 51054623.ZIP
# Example for Red Hat 7: kit_saphana_file = "/storage/HANADB/51054623.ZIP"
# 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"

##########################################################
Expand Down
8 changes: 3 additions & 5 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ DB-HOSTNAME-2 = "hanadb-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-IMAGE = "ibm-redhat-8-4-amd64-sap-hana-4"
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"
Expand All @@ -154,7 +154,7 @@ APP-HOSTNAME-2 = "sapapp-2"
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-4-amd64-sap-hana-4"
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"
Expand Down Expand Up @@ -200,9 +200,7 @@ hana_components = "server"

kit_saphana_file = "/storage/HANADB/51055299.ZIP"
# SAP HANA Installation kit path
# Supported SAP HANA versions on Red Hat 8.4 and Suse 15.3: HANA 2.0 SP 5 Rev 57, kit file: 51055299.ZIP
# Supported SAP HANA versions on Red Hat 7.6: HANA 2.0 SP 5 Rev 52, kit file: 51054623.ZIP
# Example for Red Hat 7: kit_saphana_file = "/storage/HANADB/51054623.ZIP"
# 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"

##########################################################
Expand Down
11 changes: 5 additions & 6 deletions cli/input.auto.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ SSH_KEYS = [ "r010-57bfc315-f9e5-46bf-bf61-d87a24a9ce7a", "r010-3fcd9fe7-d4a7-41
##########################################################

share_profile = "tier-5iops"
# Enter the IOPs (IOPS per GB) tier for File Share storage. Valid values are 3, 5, and 10.
# 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"
Expand Down Expand Up @@ -84,7 +85,7 @@ DB-HOSTNAME-2 = "hanadb-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-IMAGE = "ibm-redhat-8-4-amd64-sap-hana-4"
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"
Expand All @@ -105,7 +106,7 @@ APP-HOSTNAME-2 = "sapapp-2"
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-4-amd64-sap-hana-4"
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"
Expand Down Expand Up @@ -133,9 +134,7 @@ hana_components = "server"

kit_saphana_file = "/storage/HANADB/51055299.ZIP"
# SAP HANA Installation kit path
# Supported SAP HANA versions on Red Hat 8.4 and Suse 15.3: HANA 2.0 SP 5 Rev 57, kit file: 51055299.ZIP
# Supported SAP HANA versions on Red Hat 7.6: HANA 2.0 SP 5 Rev 52, kit file: 51054623.ZIP
# Example for Red Hat 7: kit_saphana_file = "/storage/HANADB/51054623.ZIP"
# 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"

##########################################################
Expand Down
54 changes: 40 additions & 14 deletions cli/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,34 +63,60 @@ module "app-vsi" {
FINAL-DEFAULT-HOSTNAME = lower ("${each.value.APP-HOSTNAME-DEFAULT}")
}


module "file-shares" {
depends_on = [ module.vpc-subnet , module.pg ]
source = "./modules/file-shares"
for_each = {
"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" }
"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_name = data.ibm_resource_group.group.id
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
enable_file_share = true
share_size = each.value.size
share_profile = var.share_profile
SAP_SID = var.sap_sid
sap_sid = var.sap_sid
}

module "alb-prereq" {
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
}

module "alb-prereq" {
depends_on = [ module.file-shares-cleaning-up ]
source = "./modules/alb/prereq"

for_each ={
Expand Down Expand Up @@ -211,7 +237,7 @@ module "alb-hana" {
}

module "dns" {
depends_on = [ module.alb-hana ]
depends_on = [ module.alb-hana , module.file-shares-cleaning-up ]
source = "./modules/dns"
ZONE = var.ZONE
REGION = var.REGION
Expand All @@ -229,7 +255,7 @@ module "dns" {

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, 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, module.file-shares-cleaning-up , module.dns ]
IP1 = data.ibm_is_instance.app-vsi-1.primary_network_interface[0].primary_ip[0].address
PLAYBOOK_PATH = "ansible/s4pasreq.yml"
}
Expand Down
1 change: 1 addition & 0 deletions cli/modules/file-shares/cache/mount_path.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fsf-fra0451b-byok-fz.adn.networklayer.com:/949845d1_2fec_41dc_acca_9deb0f5f7a5a
11 changes: 11 additions & 0 deletions cli/modules/file-shares/cleaning-up/delete_file_share.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/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}"
11 changes: 11 additions & 0 deletions cli/modules/file-shares/cleaning-up/delete_file_shares_mounts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/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}"
88 changes: 88 additions & 0 deletions cli/modules/file-shares/cleaning-up/fs_clean_up_operations.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
########################### 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"]
}

}
25 changes: 25 additions & 0 deletions cli/modules/file-shares/cleaning-up/get_fs_ids.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/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
Loading

0 comments on commit a173ba8

Please sign in to comment.