テンプレート名
ACS-HBR-SAPHanaRestorationAutomation
テンプレートの説明
ソース SAP HANA インスタンスが存在する VPC 内に宛先 SAP HANA インスタンスを自動的に作成し、Hybrid Backup Recovery(HBR)サービスを使用して既存のソース SAP HANA インスタンスから宛先 SAP HANA インスタンスにバックアップデータをリストアし、宛先 SAP HANA インスタンスの状態を確認します。
テンプレートタイプ
自動化
所有者
Alibaba Cloud
入力パラメータ
パラメータ | 説明 | タイプ | 必須 | デフォルト値 | 制限 |
zoneId | ゾーン ID。 | 文字列 | はい | ||
vpcId | ソースインスタンスが存在する VPC。 | 文字列 | はい | ||
vSwitchId | 宛先インスタンスが属する vSwitch。 | 文字列 | はい | ||
sourceClusterId | ソースインスタンスの ID。 | 文字列 | はい | ||
vaultId | HBR バックアップボールトの ID。 | 文字列 | はい | ||
HANASID | 宛先インスタンスの SID。 | 文字列 | はい | 文字列検証の正規表現: ^[A-Z][A-Z0-9][A-Z0-9]$ | |
masterPass | ソースインスタンスのマスターアカウントのパスワード。 | 文字列 | はい | 文字列検証の正規表現: ^(?=.[0-9].)(?=.[A-Z].)(?=.[a-z].)[a-zA-Z][0-9a-zA-Z_@#$]{7,}$ | |
imageId | 宛先インスタンスのオペレーティングシステムのバージョン。 | 文字列 | はい | ||
instanceType | 宛先インスタンスのインスタンスタイプ。 | 文字列 | はい | ||
privateIpAddress | 宛先インスタンスのプライベート IP アドレス。 | 文字列 | はい | 文字列検証の正規表現: ^((192.168 | |
loginPassword | 宛先インスタンスの root ユーザーのパスワード。 | 文字列 | はい | 文字列検証の正規表現: ^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_]+$)(?![a-z0-9]+$)(?![a-z\W_]+$)(?![0-9\W_]+$)[a-zA-Z0-9\W_]{8,}$ | |
dataSize | 宛先インスタンスの /hana/data ディレクトリのサイズ。 | 文字列 | はい | 文字列検証の正規表現: (^[2-9]\d{1}$) | |
logSize | 宛先インスタンスの /hana/log ディレクトリのサイズ。 | 文字列 | はい | 文字列検証の正規表現: (^[2-9]\d{1}$) | |
sharedSize | 宛先インスタンスの /hana/shared ディレクトリのサイズ。 | 文字列 | はい | 文字列検証の正規表現: (^[2-9]\d{1}$) | |
mediaPath | SAP HANA ソフトウェアパッケージの Object Storage Service (OSS) パス。 | 文字列 | はい | 文字列検証の正規表現: ^(oss | |
dingTalkWebhook | DingTalk チャットボットの Webhook URL。 | 文字列 | はい | ||
databaseName | データベースインスタンス。 | リスト | いいえ | ['SYSTEMDB@:SYSTEMDB'] | |
customizedImage | カスタムイメージを使用するかどうかを指定します。 | ブール値 | いいえ | False | |
customizedImageId | カスタムイメージの ID。 | 文字列 | いいえ | "" | |
ECSHostname | 宛先インスタンスが属するホストの名前。 | 文字列 | いいえ | hana001 | 文字列検証の正規表現: ^([a-zA-Z0-9] |
HANAInstanceNumber | 宛先インスタンスの番号。 | 文字列 | いいえ | 00 | 文字列検証の正規表現: ^([0-8][0-9] |
systemDiskCategory | 宛先インスタンスのシステムディスクタイプ。 | 文字列 | いいえ | cloud_ssd | |
systemDiskSize | 宛先インスタンスのシステムディスクサイズ。 | 文字列 | いいえ | 100 | 文字列検証の正規表現: (^2[0-9]$) |
dataLogDiskCategory | /hana/data および /hana/log ファイルシステムのディスクタイプ。 | 文字列 | いいえ | cloud_ssd | |
sharedDiskCategory | 宛先インスタンスの /hana/shared ファイルシステムのディスクタイプ。 | 文字列 | いいえ | cloud_ssd | |
usrsapDiskCategory | 宛先インスタンスの /usr/sap ファイルシステムのディスクタイプ。 | 文字列 | いいえ | cloud_ssd | |
usrsapSize | 宛先インスタンスの /usr/sap ディレクトリのサイズ。 | 文字列 | いいえ | 50 | 文字列検証の正規表現: (^[2-9]\d{1}$) |
systemUsage | 宛先インスタンスのシステムタイプ。 | 文字列 | いいえ | custom | |
HANASapSidAdmUid | 宛先インスタンスの sidadm ユーザーの ID。 | 文字列 | いいえ | 1001 | 文字列検証の正規表現: (^[5-9]\d{2}$) |
HANASapSysGid | 宛先インスタンスの sapsys グループの ID。 | 文字列 | いいえ | 79 | 文字列検証の正規表現: (^\d+$) |
userName | 宛先インスタンスのユーザー名。 | 文字列 | いいえ | SYSTEM | |
weatherDeleteResource | 検証が成功した後、クラウドリソースを保持するかどうかを指定します。 | ブール値 | いいえ | False | |
timeout | クラウドリソースが保持される期間。単位: 分。 | 数値 | いいえ | 30 |
出力パラメータ
パラメータ | 説明 | タイプ |
Result | 文字列 |
テンプレートを実行するために必要な権限ポリシー
RAM ロールの作成方法と、必要なポリシーをロールにアタッチする方法については、「RAM ロールを作成し、必要なポリシーをロールにアタッチする」をご参照ください。
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeAvailableResource",
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"hbr:CreateClients",
"hbr:CreateHanaInstance",
"hbr:CreateHanaRestore",
"hbr:DeleteHanaInstance",
"hbr:DescribeClients",
"hbr:DescribeHanaBackupSetting",
"hbr:DescribeHanaBackupsAsync",
"hbr:DescribeHanaInstances",
"hbr:DescribeHanaRestores",
"hbr:DescribeTask",
"hbr:UpdateHanaBackupSetting"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"ros:CreateStack",
"ros:DeleteStack",
"ros:GetStack"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:ListExecutions"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
参照
詳細については、GitHub の ACS-HBR-SAPHanaRestorationAutomation.yml をご参照ください。
テンプレートコンテンツ
FormatVersion: OOS-2019-06-01
Description:
en: 'This template uses an existing VPC and SAP HANA instance(source instance) to create a single-node SAP instance(destination instance), restore the source instance backup data to the destination instance through the HBR service, and check the restored destination instance status.'
name-en: ACS-HBR-SAPHanaRestorationAutomation
Parameters:
zoneId:
Type: String
AssociationProperty: 'ALIYUN::ECS::Instance::ZoneId'
Label:
en: Availability Zones
Description:
en: The Availability Zone where SAP HANA instance will be deployed
vpcId:
Type: String
AssociationProperty: 'ALIYUN::ECS::VPC::VPCId'
Label:
en: Source VPC ID
Description:
en: VPC ID of source instance
vSwitchId:
Type: String
AssociationProperty: 'ALIYUN::VPC::VSwitch::VSwitchId'
Label:
en: Target VSwitch ID
Description:
en: VSwitch ID of destination instance
sourceClusterId:
Label:
en: Source SAP HANA instance ID
Description:
en: 'Source SAP HANA instance ID, can be found in the Cloud Backup Console - ECS Application Backup - Instance Name/ID.'
Type: String
vaultId:
Label:
en: Backup Vault ID
Description:
en: Backup vault ID
Type: String
databaseName:
Label:
en: SAP HANA Database List
Description:
en: SAP HANA database list in format of "<Source SAP HANA database name>@<Source SAP HANA system Id>". Separate multiple SAP HANA database with line breaks.
Type: List
Default:
- 'SYSTEMDB@<SID>:SYSTEMDB'
HANASID:
Type: String
ConstraintDescription:
en: '3 characters,can including capital letter or number, must starting with capital letter.'
Label:
en: SAP HANA SID
Description:
en: Destination instance SAP HANA SID
AllowedPattern: '^[A-Z][A-Z0-9][A-Z0-9]$'
masterPass:
Type: String
Label:
en: SAP HANA Master Password
Description:
en: SAP HANA master password
ConstraintDescription:
en: 'Must be at least 8 characters with uppercase, lowercase, and numeric values,can use special characters include(_,@,#,$),but can''t staring with number and specical characters.'
AllowedPattern: '^(?=.*[0-9].*)(?=.*[A-Z].*)(?=.*[a-z].*)[a-zA-Z][0-9a-zA-Z_@#$]{7,}$'
NoEcho: true
imageId:
Type: String
Label:
en: Operating System And Version
Description:
en: 'Operating system and version: <a href=''https://market.aliyun.com/products/57742013/cmjj00037618.html'' target=''_blank''>SUSE15SP1-SAP</a>, <a href=''https://market.aliyun.com/products/57742013/cmjj00036800.html'' target=''_blank''>SUSE12SP4-SAP</a>, <a href=''https://market.aliyun.com/products/57742013/cmjj031975.html'' target=''_blank''>SUSE12SP3-SAP</a>.'
AllowedValues:
- SUSE15SP1-SAP
- SUSE12SP4-SAP
- SUSE12SP3-SAP
customizedImage:
Type: Boolean
Label:
en: Use Custom Image
Description:
en: Use custom image or not
Default: false
customizedImageId:
Type: String
Label:
en: Custom Image Id
Description:
en: Please enter a custom image id
Default: ''
instanceType:
Type: String
Label:
en: Instance Type For SAP HANA Host
Description:
en: '<font color=''blue''><b>Instance type list</b></font><br> [ecs.r5.2xlarge 非認定インスタンスタイプ 64G]<br>[ecs.r5.4xlarge 非認定インスタンスタイプ 128G]<br>[ecs.c5.8xlarge <font color=''green''>SAP 認定インスタンスタイプ 64G</font>]<br>[ecs.g5.8xlarge <font color=''green''>SAP 認定インスタンスタイプ 128G</font>]<br>[ecs.r5.8xlarge <font color=''green''>SAP 認定インスタンスタイプ 256G</font>]<br>[ecs.r6.13xlarge <font color=''green''>SAP 認定インスタンスタイプ 384G</font>]<br>[ecs.se1.14xlarge <font color=''green''>SAP 認定インスタンスタイプ 480G</font>]<br>[ecs.r5.16xlarge <font color=''green''>SAP 認定インスタンスタイプ 512G</font>]<br>[ecs.re4.20xlarge <font color=''green''>SAP 認定インスタンスタイプ 960G</font>]<br>[ecs.re4.40xlarge <font color=''green''>SAP 認定インスタンスタイプ 1920G</font>]<br>[ecs.re4e.40xlarge <font color=''green''>SAP 認定インスタンスタイプ 3840G</font>].'
AllowedValues:
- ecs.r5.2xlarge(8vCPUs 64GiB)
- ecs.r5.4xlarge(16vCPUs 128GiB)
- ecs.c5.8xlarge(32vCPUs 64GiB)
- ecs.g5.8xlarge(32vCPUs 128GiB)
- ecs.r5.8xlarge(32vCPUs 256GiB)
- ecs.r6.13xlarge(52vCPUs 384GiB)
- ecs.se1.14xlarge(56vCPUs 480GiB)
- ecs.r5.16xlarge(64vCPUs 512GiB)
- ecs.re4.20xlarge(80vCPUs 960GiB)
- ecs.re4.40xlarge(160vCPUs 1920GiB)
- ecs.re4e.40xlarge(160vCPUs 3840GiB)
ECSHostname:
Type: String
Label:
en: Hostname
Description:
en: SAP HANA ECS hostname
Default: hana001
AllowedPattern: '^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-])*([a-zA-Z0-9])$'
ConstraintDescription:
en: 'The length is 2-13 characters,can starting with a capital or lowercase letter,and can contain numbers,or -,but can''t starting with - or end with -.'
privateIpAddress:
Type: String
Label:
en: Private IP Address
Description:
en: 'Private IP address for SAP HANA ECS host,please pay attention:IP address should be within VSwitch CIdR Block.'
ConstraintDescription:
en: Please input the right private IP address
AllowedPattern: '^((192\.168|172\.([1][6-9]|[2]\d|3[01]))(\.([2][0-4]\d|[2][5][0-5]|[01]?\d?\d)){2}|(\D)*10(\.([2][0-4]\d|[2][5][0-5]|[01]?\d?\d)){3})$'
loginPassword:
Type: String
Label:
en: root Passowrd
Description:
en: SAP HANA ECS root passowrd
AllowedPattern: '^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_]+$)(?![a-z0-9]+$)(?![a-z\W_]+$)(?![0-9\W_]+$)[a-zA-Z0-9\W_]{8,}$'
ConstraintDescription:
en: '8-30 characters,include(capital letter,lowercase letter,numbers or special characters).'
NoEcho: true
HANAInstanceNumber:
Type: String
Label:
en: SAP HANA Instance Number
Description:
en: SAP HANA instance number
ConstraintDescription:
en: '2 numbers,00-97.'
AllowedPattern: '^([0-8][0-9]|9[0-6])$'
Default: '00'
systemDiskCategory:
Default: cloud_ssd
AllowedValues:
- cloud_efficiency
- cloud_ssd
Label:
en: System Disk Type
Description:
en: 'System disk category: Ultra Disk,SSD disk.'
Type: String
systemDiskSize:
Default: '100'
Type: String
Label:
en: System Disk Size
Description:
en: '/ file system size,unit:GB,range:20~500G.'
ConstraintDescription:
en: 'Must be an integer,range:20~500G.'
AllowedPattern: '(^2[0-9]$)|(^[3-9]\d$)|(^[1-4]\d{2}$)|500$'
dataLogDiskCategory:
Default: cloud_ssd
AllowedValues:
- cloud_essd PL1
- cloud_essd PL2
- cloud_essd PL3
- cloud_ssd
Label:
en: /hana/data And /hana/log File System Disk Category
Description:
en: '1. /hana/data and /hana/log file system disk category: ESSD disk,SSD disk.<br>2. The higher the performance level that you can select. For example, PL2 is available for an enhanced SSD of more than 460 GiB and PL3 is available for an enhanced SSD of more than 1260 GiB. A higher performance level indicates a higher fee:<ul><li> cloud_essd PL1(up to 50,000 IOPS per disk)</li><li> cloud_essd PL2(up to 100,000 IOPS per disk)</li><li> cloud_essd PL3(up to 1,000,000 IOPS per disk)</li></ul>'
Type: String
dataSize:
Type: String
Label:
en: /hana/data File System Size
Description:
en: '/hana/data file system size,unit:GB,SAP recommendation:Size >= 1 x RAM.'
ConstraintDescription:
en: 'Must be an integer,range:20~32768G.'
AllowedPattern: '(^[2-9]\d{1}$)|(^[1-9]\d{2}$)|(^[1-9]\d{3}$)|(^[1-2]\d{4}$)|(^3[0-2][0-7][0-6][0-8]$)'
logSize:
Type: String
Label:
en: /hana/log File System Size
Description:
en: '/hana/log file system size,unit:GB,SAP recommendation:[systems ≤ 512GB ] Sizeredolog = 1/2 x RAM;[systems > 512GB ] Sizeredolog(min) = 512GB.'
ConstraintDescription:
en: 'Must be an integer,range:20~32768G.'
AllowedPattern: '(^[2-9]\d{1}$)|(^[1-9]\d{2}$)|(^[1-9]\d{3}$)|(^[1-2]\d{4}$)|(^3[0-2][0-7][0-6][0-8]$)'
sharedDiskCategory:
Default: cloud_ssd
AllowedValues:
- cloud_efficiency
- cloud_ssd
- cloud_essd
Label:
en: /hana/shared File System Disk Category
Description:
en: '/hana/shared file system disk category: Ultra Disk, SSD disk, ESSD disk.'
Type: String
sharedSize:
Type: String
Label:
en: /hana/shared File System Size
Description:
en: '/hana/shared file system size,unit:GB,SAP recommendation: Sizeinstallation(single-node) = MIN(1 x RAM; 1 TB).'
ConstraintDescription:
en: 'Must be an integer,range:20~32768G.'
AllowedPattern: '(^[2-9]\d{1}$)|(^[1-9]\d{2}$)|(^[1-9]\d{3}$)|(^[1-2]\d{4}$)|(^3[0-2][0-7][0-6][0-8]$)'
usrsapDiskCategory:
Default: cloud_ssd
AllowedValues:
- cloud_efficiency
- cloud_ssd
- cloud_essd
Label:
en: /usr/sap File System Disk Category
Description:
en: '/usr/sap file system disk category: Ultra Disk, SSD disk, ESSD disk.'
Type: String
usrsapSize:
Type: String
Label:
en: /usr/sap File System Size
Description:
en: '/usr/sap file system size,unit:GB.'
Default: '50'
ConstraintDescription:
en: 'Must be an integer,range:20~32768G.'
AllowedPattern: '(^[2-9]\d{1}$)|(^[1-9]\d{2}$)|(^[1-9]\d{3}$)|(^[1-2]\d{4}$)|(^3[0-2][0-7][0-6][0-8]$)'
mediaPath:
Type: String
Label:
en: SAP HANA Software OSS Path
Description:
en: 'Please download the SAP HANA installation media from SAP software download center(Don''t need to extract, the packages are like these:51053381_part1.exe or.rar) and upload them into OSS bucket,input the full path starting with oss://. eg: oss://{bucket_name}/hana.'
ConstraintDescription:
en: 'Starting with oss.eg: oss://{bucket_name}/hana.'
AllowedPattern: '^(oss|https|http)://[\S\w]+([\S\w])+$'
systemUsage:
Type: String
Label:
en: SAP HANA System Usage
Description:
en: 'SAP HANA system usage(custom,development,test,production).'
Default: custom
AllowedValues:
- custom
- development
- test
- production
HANASapSidAdmUid:
Type: String
Label:
en: SAP HANA sidadm User Id
Description:
en: 'sidadm user Id,Only number,range:500~65532,default value:1001.'
Default: '1001'
ConstraintDescription:
en: 'Only number,range:500~65532.'
AllowedPattern: '(^[5-9]\d{2}$)|(^[1-9]\d{3}$)|(^[1-5]\d{4}$)|(^6[0-5][0-5][0-3][0-2]$)'
HANASapSysGid:
Type: String
Label:
en: SAP HANA sapsys Group Id
Description:
en: 'Sapsys group Id,Only number,default value:79.'
Default: '79'
ConstraintDescription:
en: Only number
AllowedPattern: (^\d+$)
userName:
Label:
en: Username of SYSTEMDB
Description:
en: Input username of SYSTEMDB.
Type: String
Default: SYSTEM
weatherDeleteResource:
Label:
en: Retain Cloud Resources
Description:
en: 'Whether to reserve cloud resources after verifying the successful backup, not reserved by default. When this parameter is selected and the backup is successfully restored, the''Cloud Resource Retention Duration'' parameter will be invalid.'
Type: Boolean
Default: false
timeout:
Label:
en: 'Cloud Resource Retention Time (Unit: Minutes)'
Description:
en: 'After the test is completed/failed, the length of time to reserve cloud resources (unit: minutes).'
Type: Number
Default: '30'
dingTalkWebhook:
Label:
en: DingTalk Robot Webhook
Description:
en: 'Sends notification to DingTalk via webhook for asking approval. The execution remains paused until approved or rejected. Please refer https://open-doc.dingtalk.com/microapp/serverapi2/qf2nxq for details.'
Type: String
Tasks:
- Name: checkHanaInstanceType
Action: 'ACS::CheckFor'
Description:
en: Check SAP HANA instance type availability in current available zones
Properties:
Service: ECS
API: DescribeAvailableResource
Parameters:
ZoneId: '{{ zoneId }}'
RegionId: '{{ACS::RegionId}}'
InstanceType:
'Fn::Select':
- 0
- 'Fn::Split':
- (
- '{{ instanceType }}'
DestinationResource: InstanceType
PropertySelector: 'AvailableZones.AvailableZone[0].Status'
DesiredValues:
- Available
Retries: 2
- Name: checkHanaBackupSetting
Action: 'ACS::CheckFor'
Description:
en: Check source SAP HANA backup settings
Properties:
Service: HBR
API: DescribeHanaBackupSetting
Parameters:
VaultId: '{{ vaultId }}'
ClusterId: '{{ sourceClusterId }}'
DatabaseName:
'Fn::Select':
- 0
- 'Fn::Split':
- '@'
- '{{ ACS::TaskLoopItem }}'
PropertySelector: HanaBackupSetting.CatalogBackupUsingBackint
DesiredValues:
- true
Retries: 2
Loop:
Items: '{{ databaseName }}'
RateControl:
MaxErrors: 0
Mode: Concurrency
Concurrency: 1
- Name: createStack
Action: 'ACS::ExecuteAPI'
Description:
en: Create a SAP HANA single node stack.
Properties:
Service: ROS
API: CreateStack
Parameters:
StackName: 'HBR-{{ACS::ExecutionId}}'
TimeoutInMinutes: 60
DisableRollback: true
Parameters:
- ParameterKey: ImageId
ParameterValue: '{{ imageId }}'
- ParameterKey: CustomizedImageId
ParameterValue: '{{ customizedImageId }}'
- ParameterKey: CustomizedImage
ParameterValue: '{{ customizedImage }}'
- ParameterKey: ZoneId
ParameterValue: '{{ zoneId }}'
- ParameterKey: VpcId
ParameterValue: '{{ vpcId }}'
- ParameterKey: VSwitchId
ParameterValue: '{{ vSwitchId }}'
- ParameterKey: InstanceType
ParameterValue: '{{ instanceType }}'
- ParameterKey: ECSHostname
ParameterValue: '{{ ECSHostname }}'
- ParameterKey: PrivateIpAddress
ParameterValue: '{{ privateIpAddress }}'
- ParameterKey: LoginPassword
ParameterValue: '{{ loginPassword }}'
- ParameterKey: HANASID
ParameterValue: '{{ HANASID }}'
- ParameterKey: HANAInstanceNumber
ParameterValue: '{{ HANAInstanceNumber }}'
- ParameterKey: SystemDiskCategory
ParameterValue: '{{ systemDiskCategory }}'
- ParameterKey: SystemDiskSize
ParameterValue: '{{ systemDiskSize }}'
- ParameterKey: DataLogDiskCategory
ParameterValue: '{{ dataLogDiskCategory }}'
- ParameterKey: DataSize
ParameterValue: '{{ dataSize }}'
- ParameterKey: LogSize
ParameterValue: '{{ logSize }}'
- ParameterKey: SharedDiskCategory
ParameterValue: '{{ sharedDiskCategory }}'
- ParameterKey: SharedSize
ParameterValue: '{{ sharedSize }}'
- ParameterKey: UsrsapDiskCategory
ParameterValue: '{{ usrsapDiskCategory }}'
- ParameterKey: UsrsapSize
ParameterValue: '{{ usrsapSize }}'
- ParameterKey: MasterPass
ParameterValue: '{{ masterPass }}'
- ParameterKey: MediaPath
ParameterValue: '{{ mediaPath }}'
- ParameterKey: SystemUsage
ParameterValue: '{{ SystemUsage }}'
- ParameterKey: HANASapSidAdmUid
ParameterValue: '{{ HANASapSidAdmUid }}'
- ParameterKey: HANASapSysGid
ParameterValue: '{{ HANASapSysGid }}'
TemplateURL: 'https://sap-automation-{{ACS::RegionId}}.oss-{{ACS::RegionId}}.aliyuncs.com/Public_V1/HANA/HANA_Single_Node.json'
Outputs:
StackId:
Type: String
ValueSelector: StackId
- Name: untilStackReady
Action: 'ACS::WaitFor'
OnError: getExecutionFaildMessage
Description:
en: Wait the stack status util CREATE_COMPLETE
DelayType: Constant
Delay: 300
Retries: 12
Properties:
Service: ROS
API: GetStack
Parameters:
StackId: '{{createStack.StackId}}'
DesiredValues:
- CREATE_COMPLETE
StopRetryValues:
- CREATE_FAILED
- CHECK_FAILED
- ROLLBACK_FAILED
- ROLLBACK_COMPLETE
- CREATE_ROLLBACK_COMPLETE
- CREATE_ROLLBACK_FAILED
PropertySelector: Status
Outputs:
HANAServerId:
Type: String
ValueSelector: '.Outputs[] | select(.OutputKey == "HANAServerId") | .OutputValue'
HANAServerLog:
Type: Json
ValueSelector: '.Outputs[] | select(.OutputKey == "InstallLog") | .OutputValue'
- Name: checkHanaServerLog
Action: 'ACS::CheckFor'
OnError: getExecutionFaildMessage
Description:
en: Check SAP HANA installation log
Properties:
Service: ROS
API: GetStack
Parameters:
StackId: '{{createStack.StackId}}'
PropertySelector: '.Outputs[] | select(.OutputKey == "InstallLog") | .OutputValue'
DesiredValues:
- '{"HANANode": "SUCCESS"}'
Retries: 2
- Name: createHANAInstance
Action: 'ACS::ExecuteAPI'
OnError: getExecutionFaildMessage
Description:
en: Create HBR SAP HANA instance
Properties:
Service: HBR
API: CreateHanaInstance
Parameters:
VaultId: '{{ vaultId }}'
EcsInstanceId: '{{ untilStackReady.HANAServerId }}'
Host: '{{ privateIpAddress }}'
HanaName: '{{ ECSHostname }}'
InstanceNumber: '{{ HANAInstanceNumber }}'
UserName: '{{ userName }}'
Password: '{{ masterPass }}'
UseSsl: true
Outputs:
ClusterId:
Type: String
ValueSelector: ClusterId
- Name: createClients
Action: 'ACS::ExecuteAPI'
OnError: getExecutionFaildMessage
Description:
en: Create HBR SAP HANA instance client
Properties:
Service: HBR
API: CreateClients
Parameters:
VaultId: '{{ vaultId }}'
AlertSetting: INHERITED
ClientInfo:
- instanceId: '{{ untilStackReady.HANAServerId }}'
accessKeyId: ''
accessKeySecret: ''
clusterId: '{{ createHANAInstance.ClusterId }}'
sourceTypes:
- HANA
Outputs:
TaskId:
Type: String
ValueSelector: TaskId
- Name: waitForCreateClient
Action: 'ACS::WaitFor'
OnError: getExecutionFaildMessage
Description:
en: Wait for the client to be created
DelayType: Constant
Delay: 5
Retries: 15
Properties:
Service: HBR
API: DescribeTask
Parameters:
TaskId: '{{ createClients.TaskId }}'
PropertySelector: Description
StopRetryValues:
- completed
DesiredValues:
- completed
- Name: waitForActivateClient
Action: 'ACS::WaitFor'
OnError: getExecutionFaildMessage
Description:
en: Wait for client activation to complete
Properties:
Service: HBR
API: DescribeClients
Parameters:
ClusterId: '{{ createHANAInstance.ClusterId }}'
VaultId: '{{ vaultId }}'
SourceType: HANA
ClientType: ECS_AGENT
PropertySelector: 'Clients.Client[].Status'
StopRetryValues:
- ACTIVATED
- INSTALL_FAILED
DesiredValues:
- ACTIVATED
Retries: 5
Outputs:
ClientId:
Type: String
ValueSelector: 'Clients.Client[].ClientId'
- Name: RestoreBuckup
Action: 'ACS::HBR::RestoreHanaDatabaseBackup'
OnError: getExecutionFaildMessage
Description:
en: Restore and verify backup
Properties:
vaultId: '{{ vaultId }}'
sourceClusterId: '{{ sourceClusterId }}'
sourceSystemName:
'Fn::Select':
- 0
- 'Fn::Split':
- ':'
- '{{ ACS::TaskLoopItem }}'
clusterId: '{{ createHANAInstance.ClusterId }}'
databaseName:
'Fn::Select':
- 1
- 'Fn::Split':
- ':'
- '{{ ACS::TaskLoopItem }}'
HANAInstanceServerId: '{{ untilStackReady.HANAServerId }}'
HANASID: '{{ HANASID }}'
masterClientId: '{{ waitForActivateClient.ClientId }}'
Loop:
Items: '{{ databaseName }}'
RateControl:
MaxErrors: 0
Mode: Concurrency
Concurrency: 1
- Name: runCommand
Action: 'ACS::ECS::RunCommand'
OnSuccess: DingTalkNotify
OnError: getExecutionFaildMessage
Description:
en: Verify the running status of the SAP HANA instance
Properties:
regionId: '{{ ACS::RegionId }}'
commandContent:
'Fn::Join':
- ''
- - 'su - '
- 'Fn::Jq':
- First
- .key | ascii_downcase
- key: '{{ HANASID }}'
- 'adm -c "sapcontrol -nr '
- '{{ HANAInstanceNumber }}'
- ' -function GetProcessList"; if [[ $? -eq 3 ]]; then exit 0;fi'
instanceId: '{{ untilStackReady.HANAServerId }}'
commandType: RunShellScript
timeout: '180'
Outputs:
commandOutputs:
Type: String
ValueSelector: invocationOutput
- Name: getExecutionFaildMessage
Action: 'ACS::ExecuteAPI'
Description:
en: Get execution failure information
Properties:
Service: OOS
API: ListExecutions
Parameters:
ExecutionId: '{{ ACS::ExecutionId }}'
Outputs:
statusMessage:
Type: String
ValueSelector: 'Executions[].StatusMessage'
- Name: DingTalkNotifyExecutionFailed
Action: 'ACS::Notify'
OnSuccess: sleepTask
Description:
en: Notification execution failure message
Properties:
NotifyType: WebHook
WebHook:
URI: '{{ dingTalkWebhook }}'
Headers:
Content-Type: application/json
Content:
msgtype: markdown
markdown:
title: '{{ ACS::CurrentUTCTime }}-HBR テスト失敗レポート'
text:
'Fn::Join':
- |+
- - '#### {{ ACS::CurrentUTCTime }}-HBR テスト失敗レポート'
- 'データベースの確認:{{ databaseName }}'
- 'エラーメッセージ:{{ getExecutionFaildMessage.statusMessage }}'
- '**テストは {{ timeout }} 分後にテストクラウドリソースを自動的にクリーンアップします。 クラウドリソースを保持するには、[OOS コンソール](https://oos.console.alibabacloud.com/{{ ACS::RegionId }}/execution/detail/{{ ACS::ExecutionId }}) に移動して実行をキャンセルしてください**'
at:
atMobiles: []
isAtAll: true
- Name: DingTalkNotify
Action: 'ACS::Notify'
Description:
en: Notify test results
Properties:
NotifyType: WebHook
WebHook:
URI: '{{ dingTalkWebhook }}'
Headers:
Content-Type: application/json
Content:
msgtype: markdown
markdown:
title: '{{ ACS::CurrentUTCTime }}-HBR テストレポート'
text:
'Fn::Join':
- |+
- - '#### {{ ACS::CurrentUTCTime }}-HBR テストレポート'
- テスト結果:SUCCESS
- 'データベースの確認:{{ databaseName }}'
- '宛先インスタンス:{{ ECSHostname }}'
- '宛先インスタンスの ID:{{ untilStackReady.HANAServerId }}'
- '**テストは {{ timeout }} 分後にテストクラウドリソースを自動的にクリーンアップします。 クラウドリソースを保持するには、[OOS コンソール](https://oos.console.alibabacloud.com/{{ ACS::RegionId }}/execution/detail/{{ ACS::ExecutionId }}) に移動して実行をキャンセルしてください**'
at:
atMobiles: []
isAtAll: true
- Name: whetherDeleteResource
Action: 'ACS::Choice'
Properties:
DefaultTask: sleepTask
Choices:
- When: '{{ weatherDeleteResource }}'
NextTask: 'ACS::END'
- Name: sleepTask
Action: 'ACS::Sleep'
Properties:
Duration: 'PT{{ timeout }}M'
- Name: deleteStack
Action: 'ACS::ExecuteApi'
OnError: getCleanupFaildMessage
Description:
en: Delete the stack
Properties:
Service: ROS
API: DeleteStack
Parameters:
StackId: '{{createStack.StackId}}'
- Name: describeHanaInstances
Action: 'ACS::ExecuteAPI'
OnError: getCleanupFaildMessage
Description:
en: Query HBR SAP HANA instance
Properties:
Service: HBR
API: DescribeHanaInstances
Parameters:
VaultId: '{{ vaultId }}'
Outputs:
Hanas:
Type: Json
ValueSelector: Hanas
- Name: whetherDeleteHanaInstances
Action: 'ACS::Choice'
Properties:
DefaultTask: untilStackCleanup
Choices:
- When:
'Fn::Equals':
- '{{ ECSHostname }}'
- 'Fn::Jq':
- First
- '.key.Hana[] | select(.Host == "{{ privateIpAddress }}") | .HanaName'
- key: '{{ describeHanaInstances.Hanas }}'
NextTask: deleteHanaInstance
- Name: deleteHanaInstance
Action: 'ACS::ExecuteApi'
OnError: getCleanupFaildMessage
Description:
en: Delete the stack
Properties:
Service: HBR
API: DeleteHanaInstance
Parameters:
VaultId: '{{ vaultId }}'
ClusterId: '{{ createHANAInstance.ClusterId }}'
Sid: '{{ HANASID }}'
- Name: untilStackCleanup
Action: 'ACS::WaitFor'
OnError: getCleanupFaildMessage
OnSuccess: 'ACS::END'
Description:
en: Wait the stack status util DELETE_COMPLETE
DelayType: Constant
Delay: 300
Retries: 12
Properties:
Service: ROS
API: GetStack
Parameters:
StackId: '{{createStack.StackId}}'
DesiredValues:
- DELETE_COMPLETE
StopRetryValues:
- DELETE_FAILED
- DELETE_COMPLETE
PropertySelector: Status
- Name: getCleanupFaildMessage
Action: 'ACS::ExecuteAPI'
Description:
en: Get cleanup failure information
Properties:
Service: OOS
API: ListExecutions
Parameters:
ExecutionId: '{{ ACS::ExecutionId }}'
Outputs:
statusMessage:
Type: String
ValueSelector: 'Executions[].StatusMessage'
- Name: DingTalkNotifyCleanupFailed
Action: 'ACS::Notify'
Description:
en: Notification cleanup failed
Properties:
NotifyType: WebHook
WebHook:
URI: '{{ dingTalkWebhook }}'
Headers:
Content-Type: application/json
Content:
msgtype: markdown
markdown:
title: '{{ ACS::CurrentUTCTime }}-HBR テストのクリーンアップ失敗レポート'
text:
'Fn::Join':
- |+
- - '#### {{ ACS::CurrentUTCTime }}-HBR テストのクリーンアップ失敗レポート'
- 'データベースの確認:{{ databaseName }}'
- 'エラーメッセージ:{{ getCleanupFaildMessage.statusMessage }}'
- '**クラウドリソースの自動クリーンアップに失敗しました。 クラウドリソースを手動でクリーンアップする必要があります**'
at:
atMobiles: []
isAtAll: true
Outputs:
Result:
Type: String
Value: '{{ untilStackReady.HANAServerId }}'