Template name
ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL
Template description
Installs or uninstalls an extension on multiple Elastic Compute Service (ECS) instances at a time.
Template type
Automated
Owner
Alibaba Cloud
Input parameters
Parameter | Description | Type | Required | Default value | Limit |
packageName | The name of the extension to be installed. | String | Yes | ||
regionId | The region ID. | String | No | {{ ACS::RegionId }} | |
action | The operation that you want to perform. | String | No | install | |
packageVersion | The version of the extension. | String | No | "" | |
targets | The ECS instances on which you want to install the extension. | Json | No | {'Type': 'ResourceIds', 'ResourceIds': [], 'RegionId': '{{ regionId }}'} | |
orderId | The order ID. | String | No | "" | |
rateControl | The rate control settings. | Json | No | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
parameters | The parameters in the command. | Json | No | {} | |
OOSAssumeRole | The Resource Access Management (RAM) role that is assumed by CloudOps Orchestration Service (OOS). | String | No | "" |
Output parameters
Parameter | Description | Type |
commandOutput | List | |
configurationOutput | List |
Permission policy that is required to execute the template
{
"Version": "1",
"Statement": [
{
"Action": [
"bssopenapi:GetOrderDetail"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"ecs:DescribeCloudAssistantStatus",
"ecs:DescribeInstances",
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetTemplate",
"oos:ListInstancePackageStates",
"oos:UpdateInstancePackageState"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oss:GetObject"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
References
For more information, see ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL.yml at GitHub.
Template content
FormatVersion: OOS-2019-06-01
Description:
en: Use this template to install oos package on ecs
zh-cn: the description in Chinese
name-en: ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL
name-zh-cn: the description in Chinese
categories:
- run_command
- application_manage
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: the description in Chinese
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
action:
Label:
en: Action
zh-cn: the description in Chinese
Type: String
AllowedValues:
- install
- uninstall
- update
Default: install
AssociationPropertyMetadata:
LocaleKey: SoftwareOperationType
packageName:
Label:
en: packageName
zh-cn: the description in Chinese
Type: String
AssociationProperty: 'ALIYUN::OOS::Package::PackageName'
AssociationPropertyMetadata:
RegionId: regionId
Target: ${targets}
packageVersion:
Label:
en: packageVersion
zh-cn: the description in Chinese
Type: String
AssociationProperty: 'ALIYUN::OOS::Package::PackageVersion'
AssociationPropertyMetadata:
TemplateName: ${packageName}
PublicDisabled: true
DoRequestAtFirst: true
Default: ''
targets:
Type: Json
Label:
en: TargetInstance
zh-cn: the description in Chinese
Default:
Type: ResourceIds
ResourceIds: []
RegionId: '{{ regionId }}'
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
Status: Running
orderId:
Description:
en: The ID of Order
zh-cn: the description in Chinese
Type: String
Default: ''
rateControl:
Label:
en: RateControl
zh-cn: the description in Chinese
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
parameters:
Label:
en: Parameters
zh-cn: the description in Chinese
Type: Json
Default: {}
AssociationProperty: TemplateParameter
AssociationPropertyMetadata:
TemplateName: packageName
TemplateVersion: packageVersion
TemplateType: Package
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: the description in Chinese
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstanceFromOrderId
Action: ACS::WaitFor
When:
Fn::Not:
'Fn::Equals':
- '{{ orderId }}'
- ''
Description:
en: Views the ECS instances
zh-cn: the description in Chinese
Properties:
Service: BssOpenApi
API: GetOrderDetail
Parameters:
RegionId: '{{ regionId }}'
OrderId: '{{ orderId }}'
DesiredValues:
- Paid
StopRetryValues:
- Cancelled
PropertySelector: Data.OrderList.Order[].PaymentStatus
Outputs:
instanceIds:
Type: List
ValueSelector: Data.OrderList.Order[].InstanceIDs | fromjson | .[]
- Name: getInstanceFromTargets
When:
'Fn::Equals':
- '{{ orderId }}'
- ''
Description:
en: Views the ECS instances
zh-cn: the description in Chinese
Action: 'ACS::SelectTargets'
Properties:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: 'Instances.Instance[].InstanceId'
- Name: configurePackage
Description:
en: Configure Package
zh-cn: the description in Chinese
Action: ACS::ECS::ConfigureOOSPackageWithTemporaryURLFullActions
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
action: '{{ action }}'
packageName: '{{ packageName }}'
packageVersion: '{{ packageVersion }}'
parameters: '{{ parameters }}'
Loop:
Items:
Fn::If:
- 'Fn::Equals':
- '{{ orderId }}'
- ''
- '{{ getInstanceFromTargets.instanceIds }}'
- '{{ getInstanceFromOrderId.instanceIds }}'
RateControl: '{{ rateControl }}'
Outputs:
commandOutputs:
AggregateType: 'Fn::ListJoin'
AggregateField: commandOutput
configurationOutputs:
AggregateType: 'Fn::ListJoin'
AggregateField: configurationOutput
Outputs:
commandOutput:
Type: Json
ValueSelector: '.|{"InstanceId": "{{ ACS::TaskLoopItem }}", "InstanceResult": [{"Package": "{{packageName}}", "PackageResult": .commandOutput}]}'
configurationOutput:
Type: Json
ValueSelector: '.|{"InstanceId": "{{ ACS::TaskLoopItem }}", "InstanceResult": [{"Package": "{{packageName}}", "PackageResult": .configurationOutput}]}'
Outputs:
commandOutput:
Type: List
Value: '{{ configurePackage.commandOutputs }}'
configurationOutput:
Type: List
Value: '{{ configurePackage.configurationOutputs }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- packageName
- action
- packageVersion
- parameters
Label:
default:
zh-cn: the description in Chinese
en: Configure Parameters
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: the description in Chinese
en: Select Instances
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: the description in Chinese
en: Control Options