文档

ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL

更新时间:

模板名称

ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL 安装/卸载扩展程序

立即执行

模板描述

安装/卸载扩展程序

模板类型

自动化

所有者

Alibaba Cloud

输入参数

参数名称

描述

类型

是否必填

默认值

约束

packageName

要安装的扩展程序

String

regionId

地域ID

String

{{ ACS::RegionId }}

action

执行动作

String

install

packageVersion

扩展程序版本

String

“”

targets

目标实例

Json

{‘Type’: ‘ResourceIds’, ‘ResourceIds’: [], ‘RegionId’: ‘{{ regionId }}’}

orderId

订单ID

String

“”

rateControl

任务执行的并发比率

Json

{‘Mode’: ‘Concurrency’, ‘MaxErrors’: 0, ‘Concurrency’: 10}

parameters

命令中的参数

Json

{}

OOSAssumeRole

OOS扮演的RAM角色

String

“”

输出参数

参数名称

描述

类型

commandOutput

List

configurationOutput

List

执行此模板需要的权限策略

{
    "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"
        }
    ]
}

详情

ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL详情

模板内容

FormatVersion: OOS-2019-06-01
Description:
  en: Use this template to install oos package on ecs
  zh-cn: 安装/卸载扩展程序
  name-en: ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL
  name-zh-cn: 安装/卸载扩展程序
  categories:
    - run_command
    - application_manage
Parameters:
  regionId:
    Type: String
    Label:
      en: RegionId
      zh-cn: 地域ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  action:
    Label:
      en: Action
      zh-cn: 执行动作
    Type: String
    AllowedValues:
      - install
      - uninstall
      - update
    Default: install
    AssociationPropertyMetadata:
      LocaleKey: SoftwareOperationType
  packageName:
    Label:
      en: packageName
      zh-cn: 要安装的扩展程序
    Type: String
    AssociationProperty: 'ALIYUN::OOS::Package::PackageName'
    AssociationPropertyMetadata:
      RegionId: regionId
      Target: ${targets}
  packageVersion:
    Label:
      en: packageVersion
      zh-cn: 扩展程序版本
    Type: String
    AssociationProperty: 'ALIYUN::OOS::Package::PackageVersion'
    AssociationPropertyMetadata:
      TemplateName: ${packageName}
      PublicDisabled: true
      DoRequestAtFirst: true
    Default: ''
  targets:
    Type: Json
    Label:
      en: TargetInstance
      zh-cn: 目标实例
    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: 订单ID
    Type: String
    Default: ''
  rateControl:
    Label:
      en: RateControl
      zh-cn: 任务执行的并发比率
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  parameters:
    Label:
      en: Parameters
      zh-cn: 命令中的参数
    Type: Json
    Default: {}
    AssociationProperty: TemplateParameter
    AssociationPropertyMetadata:
      TemplateName: packageName
      TemplateVersion: packageVersion
      TemplateType: Package
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: OOS扮演的RAM角色
    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: 通过订单ID获取ECS实例
    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: 获取ECS实例
    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: 配置软件包
    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: 配置参数
            en: Configure Parameters
      - Parameters:
          - regionId
          - targets
        Label:
          default:
            zh-cn: 选择实例
            en: Select Instances
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: 高级选项
            en: Control Options