ACS-ECS-ApproveBulkyRunCommand

更新时间:2024-09-05 08:47:22

模板名称

ACS-ECS-ApproveBulkyRunCommand 审批后批量执行命令

立即执行

模板描述

审批后批量执行命令

模板类型

自动化

所有者

Alibaba Cloud

输入参数

参数名称

描述

类型

是否必填

默认值

约束

参数名称

描述

类型

是否必填

默认值

约束

targets

目标实例

Json

commandContent

ECS实例中执行的云助手命令

String

webHookUrl

钉钉群助手的webhook地址

String

atMobiles

审批通知中被@的群成员的钉钉手机号

List

approvers

可以审批任务的用户

List

regionId

地域ID

String

{{ ACS::RegionId }}

commandType

云助手命令类型

String

RunShellScript

rateControl

任务执行的并发比率

Json

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

atAll

当群助手向钉钉群中发送审批通知时是否@所有人

String

false

minRequiredApprovals

最低需要通过审批的数量

Number

1

OOSAssumeRole

OOS扮演的RAM角色

String

“”

输出参数

参数名称

描述

类型

参数名称

描述

类型

commandOutputs

List

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

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:DescribeInstances",
                "ecs:DescribeInvocationResults",
                "ecs:DescribeInvocations",
                "ecs:DescribeManagedInstances",
                "ecs:RunCommand"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

详情

ACS-ECS-ApproveBulkyRunCommand详情

模板内容

FormatVersion: OOS-2019-06-01
Description:
  en: Approve Bulky RunCommand
  zh-cn: 审批后批量执行命令
  name-en: ACS-ECS-ApproveBulkyRunCommand
  name-zh-cn: 审批后批量执行命令
  categories:
    - instance_manage
Parameters:
  regionId:
    Type: String
    Label:
      en: RegionId
      zh-cn: 地域ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  targets:
    Label:
      en: TargetInstance
      zh-cn: 目标实例
    Type: Json
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  commandType:
    Label:
      en: CommandType
      zh-cn: 云助手命令类型
    Type: String
    AllowedValues:
      - RunBatScript
      - RunPowerShellScript
      - RunShellScript
    Default: RunShellScript
  commandContent:
    Label:
      en: CommandContent
      zh-cn: 在ECS实例中执行的云助手命令
    Type: String
    AssociationProperty: Code
  rateControl:
    Label:
      en: RateControl
      zh-cn: 任务执行的并发比率
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  webHookUrl:
    Label:
      en: WebHookUrl
      zh-cn: 钉钉群助手的webhook地址
    Description:
      en: >-
        e.g.https://oapi.dingtalk.com/robot/send?access_token=1234zxcvaksdq31414,acquiring DingTalk webhook please refer to second appendix in https://help.aliyun.com/document_detail/144679.html.
      zh-cn: >-
        形如https://oapi.dingtalk.com/robot/send?access_token=1234zxcvaksdq31414,具体钉钉WebHook获取请参考https://help.aliyun.com/document_detail/144679.html#h2--2-webhook-5。
    Type: String
  atMobiles:
    Label:
      en: AtMobiles
      zh-cn: 审批通知中被@的群成员的钉钉手机号
    Type: List
  atAll:
    Label:
      en: AtAll
      zh-cn: 当群助手向钉钉群中发送审批通知时是否@所有人
    Type: String
    Default: 'false'
  approvers:
    Label:
      en: Approvers
      zh-cn: 可以审批任务的用户
    Description:
      en: The name to fill is the front part of @ in the RAM user name,if  RAM user is user001@companyAlias.onaliyun.com, then fill  user001  in list.
      zh-cn: 用户名是RAM子用户名称中@前面的部分,比如RAM子用户为user001@companyAlias.onaliyun.com,那么列表中填写user001即可。
    Type: List
    AssociationProperty: ALIYUN::RAM::User
  minRequiredApprovals:
    Label:
      en: MinRequiredApprovals
      zh-cn: 最低需要通过审批的数量
    Type: Number
    Default: 1
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: OOS扮演的RAM角色
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: approveBulkyRuncommand
    Action: 'ACS::Approve'
    Description:
      en: Approve operation task runcommand
      zh-cn: 审批运维任务
    Properties:
      Approvers: '{{approvers}}'
      MinRequiredApprovals: '{{minRequiredApprovals}}'
      NotifyType: WebHook
      WebHook:
        URI: '{{webhookUrl}}'
        Headers:
          Content-Type: application/json
        Content:
          msgtype: text
          text:
            content: >-
              Notify: Please approve the task execution to create ECS instance sent by
              {{ACS::RegionId}} oos {{ACS::ExecutionId}} .
          at:
            atMobiles: '{{atMobiles}}'
            isAtAll: '{{atAll}}'

  - Name: bulkyRunCommand
    Action: ACS::Template
    Description:
      en: Execute cloud assistant command
      zh-cn: 执行云助手命令
    Properties:
      TemplateName: ACS-ECS-BulkyRunCommand
      Parameters:
        regionId: '{{ regionId }}'
        commandContent: '{{ commandContent }}'
        commandType: '{{ commandType }}'
        targets: '{{ targets }}'
        rateControl: '{{ rateControl }}'
    Outputs:
      commandOutputs:
        Type: List
        ValueSelector: commandOutputs
Outputs:
  commandOutputs:
    Type: List
    Value: '{{ bulkyRunCommand.commandOutputs }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - webHookUrl
          - atMobiles
          - atAll
          - approvers
          - minRequiredApprovals
        Label:
          default:
            zh-cn: 配置审批
            en: Configure Approval
      - Parameters:
          - commandType
          - commandContent
        Label:
          default:
            zh-cn: 执行命令选型
            en: Configure Command
      - Parameters:
          - regionId
          - targets
        Label:
          default:
            zh-cn: 选择实例
            en: Select Instances
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: 高级选项
            en: Control Options
  • 本页导读 (1)
  • 模板名称
  • 模板描述
  • 模板类型
  • 所有者
  • 输入参数
  • 输出参数
  • 执行此模板需要的权限策略
  • 详情
AI助理

点击开启售前

在线咨询服务

你好,我是AI助理

可以解答问题、推荐解决方案等