Template name
ACS-ECS-BulkyConfigureSoftwareFromEcsAppStore
Template description
Installs or uninstalls software 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 |
targets | The ECS instances on which you want to install software. | Json | Yes | ||
regionId | The region ID. | String | No | {{ ACS::RegionId }} | |
softwareType | The software type. | String | No | Aliyun | |
action | The operation that you want to perform. | String | No | install | |
aliyunSoftwareName | The name of the software provided by Alibaba Cloud. | String | No | Logtail | |
communitySoftwareName | The name of the software provided by the community. | String | No | DockerCE | |
installer | The source of the software package. | String | No | yum | |
softwareName | The software name. | String | No | "" | |
rateControl | The rate control settings. | Json | No | {'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} | |
OOSAssumeRole | The Resource Access Management (RAM) role that is assumed by CloudOps Orchestration Service (OOS). | String | No | "" |
Output parameters
Parameter | Description | Type |
commandOutput | String |
Permission policy that is required to execute the template
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
References
For more information, see ACS-ECS-BulkyConfigureSoftwareFromEcsAppStore.yml at GitHub.
Template content
FormatVersion: OOS-2019-06-01
Description:
en: Use this template to install software on ecs
zh-cn: the description in Chinese
name-en: Bulky Configure Software
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 }}'
softwareType:
Type: String
Label:
en: Software Type
zh-cn: the description in Chinese
AllowedValues:
- Aliyun
- Community
- SystemRepository
Default: Aliyun
AssociationPropertyMetadata:
LocaleKey: SoftwareType
action:
Type: String
Label:
en: Action
zh-cn: the description in Chinese
AllowedValues:
- install
- uninstall
Default: install
AssociationPropertyMetadata:
LocaleKey: SoftwareOperationType
aliyunSoftwareName:
Type: String
Label:
en: Aliyun Software Name
zh-cn: the description in Chinese
AllowedValues:
- Logtail
- CloudMonitorAgent
Default: Logtail
AssociationPropertyMetadata:
LocaleKey: AliyunSoftwareName
Visible:
Condition:
Fn::Equals:
- ${softwareType}
- Aliyun
communitySoftwareName:
Type: String
Label:
en: Community Software Name
zh-cn: the description in Chinese
AllowedValues:
- DockerCE
- BaotaPanelFree
Default: DockerCE
AssociationPropertyMetadata:
LocaleKey: CommunitySoftwareName
Visible:
Condition:
Fn::Equals:
- ${softwareType}
- Community
Description:
en: Baota Panel only supports to be installed on Linux. Information can be found in execution outputs.
zh-cn: the description in Chinese
installer:
Type: String
Label:
en: Installer
zh-cn: the description in Chinese
Default: yum
AllowedValues:
- apt-get
- yum
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${softwareType}
- SystemRepository
softwareName:
Type: String
Label:
en: Software Name
zh-cn: the description in Chinese
Default: ''
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${softwareType}
- SystemRepository
targets:
Type: Json
Label:
en: TargetInstance
zh-cn: the description in Chinese
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: ALIYUN::ECS::Instance
RegionId: regionId
Status: Running
rateControl:
Label:
en: RateControl
zh-cn: the description in Chinese
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: the description in Chinese
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
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
instanceInfos:
Type: List
ValueSelector: .Instances.Instance[] | {"osType":.OSType, "instanceId":.InstanceId}
- Name: runCommand
Action: ACS::ECS::RunCommand
Properties:
commandContent:
Fn::If:
- Fn::Equals:
- Fn::Jq:
- First
- .|map(select(.instanceId == "{{ ACS::TaskLoopItem }}").osType)[]
- '{{ getInstance.instanceInfos }}'
- linux
- Fn::If:
- Fn::Equals:
- '{{ softwareType }}'
- 'Aliyun'
- Fn::If:
- Fn::Equals:
- '{{ aliyunSoftwareName }}'
- 'Logtail'
- '{{ oos:aliyun/services/oos/commands/install_logtail_for_linux }}'
- Fn::If:
- Fn::Equals:
- '{{ aliyunSoftwareName }}'
- 'CloudMonitorAgent'
- '{{ oos:aliyun/services/oos/commands/install_CloudMonitorAgent_for_linux }}'
- |-
echo "Aliyun software ({{ aliyunSoftwareName }}) is not supported"
exit 1
- Fn::If:
- Fn::Equals:
- '{{ softwareType }}'
- 'Community'
- Fn::If:
- Fn::Equals:
- '{{ communitySoftwareName }}'
- 'DockerCE'
- '{{ oos:aliyun/services/oos/commands/install_DockerCE_for_linux }}'
- Fn::If:
- Fn::Equals:
- '{{ communitySoftwareName }}'
- 'BaotaPanelFree'
- '{{ oos:aliyun/services/oos/commands/install_BaoTaPanelFree_for_linux }}'
- |-
echo "Community software ({{ communitySoftwareName }}) is not supported"
exit 1
- '{{ oos:aliyun/services/oos/commands/install_from_linux_repository }}'
- Fn::If:
- Fn::Equals:
- '{{ softwareType }}'
- 'Aliyun'
- Fn::If:
- Fn::Equals:
- '{{ aliyunSoftwareName }}'
- 'Logtail'
- '{{ oos:aliyun/services/oos/commands/install_logtail_for_windows }}'
- Fn::If:
- Fn::Equals:
- '{{ aliyunSoftwareName }}'
- 'CloudMonitorAgent'
- '{{ oos:aliyun/services/oos/commands/install_CloudMonitorAgent_for_windows }}'
- |-
echo "Aliyun software ({{ aliyunSoftwareName }}) is not supported"
exit 1
- Fn::If:
- Fn::Equals:
- '{{ softwareType }}'
- 'Community'
- Fn::If:
- Fn::Equals:
- '{{ communitySoftwareName }}'
- 'DockerCE'
- '{{ oos:aliyun/services/oos/commands/install_DockerCE_for_windows }}'
- |-
echo "Community software ({{ communitySoftwareName }}) is not supported"
exit 1
- |-
echo "Windows system does not support SystemRepository {{ installer }}"
exit 1
instanceId: '{{ ACS::TaskLoopItem }}'
regionId: '{{ regionId }}'
commandType:
Fn::If:
- Fn::Equals:
- Fn::Jq:
- First
- .|map(select(.instanceId == "{{ ACS::TaskLoopItem }}").osType)[]
- '{{ getInstance.instanceInfos }}'
- linux
- RunShellScript
- RunPowerShellScript
enableParameter: true
parameters:
Fn::If:
- Fn::Equals:
- '{{softwareType }}'
- 'SystemRepository'
- action: '{{ action }}'
installer: '{{ installer }}'
softwareName: '{{ softwareName }}'
- action: '{{ action }}'
Loop:
Items: '{{ getInstance.instanceIds }}'
RateControl: '{{ rateControl }}'
Outputs:
commandOutputs:
AggregateType: Fn::ListJoin
AggregateField: commandOutput
Outputs:
commandOutput:
Type: String
ValueSelector: invocationOutput
Outputs:
commandOutput:
Type: String
Value: '{{ runCommand.commandOutputs }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- softwareType
- aliyunSoftwareName
- communitySoftwareName
- installer
- softwareName
- action
Label:
default:
zh-cn: the description in Chinese
en: Configure Software Parameters
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: the description in Chinese
en: Select Ecs Instances
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: the description in Chinese
en: Control Options