全部產品
Search
文件中心

CloudOps Orchestration Service:ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL

更新時間:Sep 06, 2024

模板名稱

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