全部產品
Search
文件中心

CloudOps Orchestration Service:ACS-ECS-BulkyReplaceSystemDiskInSLBDefaultServerGroup

更新時間:Sep 06, 2024

模板名稱

ACS-ECS-BulkyReplaceSystemDiskInSLBDefaultServerGroup 批量替換SLB預設服務組內的ECS執行個體的系統硬碟

立即執行

模板描述

批量替換SLB預設服務組內的ECS執行個體的系統硬碟

模板類型

自動化

所有者

Alibaba Cloud

輸入參數

參數名稱

描述

類型

是否必填

預設值

約束

imageId

源鏡像ID

String

loadBalancerId

Server Load Balancer執行個體ID

String

rateControl

任務執行的並發比率

Json

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

OOSAssumeRole

OOS扮演的RAM角色

String

“”

輸出參數

參數名稱

描述

類型

newSystemDiskIds

List

執行此模板需要的權限原則

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "slb:DescribeLoadBalancerAttribute",
                "slb:SetBackendServers"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "ecs:DescribeDisks",
                "ecs:DescribeInstances",
                "ecs:ReplaceSystemDisk",
                "ecs:StartInstance",
                "ecs:StopInstance"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

詳情

ACS-ECS-BulkyReplaceSystemDiskInSLBDefaultServerGroup詳情

模板內容

FormatVersion: OOS-2019-06-01
Description:
  en: Bulky replaces system disk of ECS instances in default server group
  zh-cn: 批量替換SLB預設服務組內的ECS執行個體的系統硬碟
  name-en: ACS-ECS-BulkyReplaceSystemDiskInSLBDefaultServerGroup
  name-zh-cn: 批量替換SLB預設服務組內的ECS執行個體的系統硬碟
  categories:
    - slb_management
Parameters:
  imageId:
    Label:
      en: The image ID for the ECS instance
      zh-cn: 源鏡像ID
    Type: String
    AssociationProperty: 'ALIYUN::ECS::Image::ImageId'
  loadBalancerId:
    Label:
      en: LoadBalancerId
      zh-cn: Server Load Balancer執行個體ID
    Type: String
  rateControl:
    Label:
      en: RateControl
      zh-cn: 任務執行的並發比率
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 1
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: OOS扮演的RAM角色
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: describeLoadBalancerAttribute
    Action: ACS::ExecuteApi
    Description:
      en: Views loadbalancer attribute
      zh-cn: 擷取負載平衡預設服務組屬性
    Properties:
      Service: SLB
      API: DescribeLoadBalancerAttribute
      Parameters:
        LoadBalancerId: '{{ loadBalancerId }}'
    Outputs:
      BackendServers:
        Type: List
        ValueSelector: BackendServers.BackendServer[]
      port:
        Type: Number
        ValueSelector: ListenerPorts.ListenerPort[]
  - Name: replaceSystemDisk
    Action: ACS::ECS::ElegantReplaceSystemDiskInSLBDefaultServerGroup
    Description:
      en: Replaces the system disk of ECS instances
      zh-cn: 更換系統硬碟
    Properties:
      loadBalancerId: '{{ LoadBalancerId }}'
      imageId: '{{ imageId }}'
      serverId:
        'Fn::Select':
          - ServerId
          - '{{ ACS::TaskLoopItem }}'
      weight:
        'Fn::Select':
          - Weight
          - '{{ ACS::TaskLoopItem }}'
      type:
        'Fn::Select':
          - Type
          - '{{ ACS::TaskLoopItem }}'
      port: '{{ describeLoadBalancerAttribute.port }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ describeLoadBalancerAttribute.BackendServers }}'
      Outputs:
        newSystemDiskIds:
          AggregateType: Fn::ListJoin
          AggregateField: newSystemDiskId
    Outputs:
      newSystemDiskId:
        Type: String
        ValueSelector: newSystemDiskId
Outputs:
  newSystemDiskIds:
    Type: List
    Value: '{{ replaceSystemDisk.newSystemDiskIds }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - imageId
          - loadBalancerId
        Label:
          default:
            zh-cn: 設定參數
            en: Configure Parameters
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: 進階選項
            en: Control Options