テンプレート名
ACS-ECS-BulkyRunCommandInSLBVServerGroup
テンプレートの説明
Server Load Balancer (SLB) インスタンスの vServer グループ内の複数の Elastic Compute Service (ECS) インスタンスで一度にコマンドを実行します。
テンプレートタイプ
自動化
所有者
Alibaba Cloud
入力パラメーター
パラメーター | 説明 | タイプ | 必須 | デフォルト値 | 制限 |
VServerGroupId | vServer グループの ID。 | String | はい | ||
commandType | クラウドアシスタントコマンドのタイプ。 | String | いいえ | RunShellScript | |
commandContent | ECS インスタンスで実行されるクラウドアシスタントコマンド。 | String | いいえ | echo hello | |
rateControl | レート制御設定。 | Json | いいえ | {'Mode': 'Concurrency', 'MaxErrors': '0', 'Concurrency': 1} | |
OOSAssumeRole | CloudOps Orchestration Service (OOS) によって引き受けられる Resource Access Management (RAM) ロール。 | String | いいえ | "" |
出力パラメーター
パラメーター | 説明 | タイプ |
commandOutputs | List |
テンプレートの実行に必要な権限ポリシー
{
"Version": "1",
"Statement": [
{
"Action": [
"slb:DescribeVServerGroupAttribute",
"slb:SetVServerGroupAttribute"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
参照
詳細については、GitHub の ACS-ECS-BulkyRunCommandInSLBVServerGroup.yml をご参照ください。
テンプレートコンテンツ
FormatVersion: OOS-2019-06-01
Description:
en: Bulky run command on ECS instances of VServer group
zh-cn: the description in Chinese
name-en: ACS-ECS-BulkyRunCommandInSLBVServerGroup
name-zh-cn: the description in Chinese
categories:
- slb_management
Parameters:
VServerGroupId:
Label:
en: VServerGroupId
zh-cn: the description in Chinese
Type: String
commandType:
Label:
en: CommandType
zh-cn: the description in Chinese
Type: String
AllowedValues:
- RunBatScript
- RunPowerShellScript
- RunShellScript
Default: RunShellScript
commandContent:
Label:
en: CommandContent
zh-cn: the description in Chinese
Type: String
AssociationProperty: Code
Default: echo hello
rateControl:
Label:
en: RateControl
zh-cn: the description in Chinese
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 1
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: the description in Chinese
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: describeVServerGroupAttribute
Action: ACS::ExecuteApi
Description:
en: Views vserver group attribute
zh-cn: the description in Chinese
Properties:
Service: SLB
API: DescribeVServerGroupAttribute
Parameters:
VServerGroupId: '{{ VServerGroupId }}'
Outputs:
BackendServers:
Type: List
ValueSelector: BackendServers.BackendServer[]
- Name: runCommand
Action: ACS::ECS::ElegantRunCommandInSLBVServerGroup
Description:
en: Execute cloud assistant command
zh-cn: the description in Chinese
Properties:
VServerGroupId: '{{ VServerGroupId }}'
commandContent: '{{ commandContent }}'
commandType: '{{ commandType }}'
serverId:
'Fn::Select':
- ServerId
- '{{ ACS::TaskLoopItem }}'
weight:
'Fn::Select':
- Weight
- '{{ ACS::TaskLoopItem }}'
type:
'Fn::Select':
- Type
- '{{ ACS::TaskLoopItem }}'
port:
'Fn::Select':
- Port
- '{{ ACS::TaskLoopItem }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ describeVServerGroupAttribute.BackendServers }}'
Outputs:
commandOutputs:
AggregateType: Fn::ListJoin
AggregateField: commandOutput
Outputs:
commandOutput:
Type: String
ValueSelector: commandOutput
Outputs:
commandOutputs:
Type: List
Value: '{{ runCommand.commandOutputs }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- VServerGroupId
- commandType
- commandContent
Label:
default:
zh-cn: the description in Chinese
en: Configure Parameters
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: the description in Chinese
en: Control