すべてのプロダクト
Search
ドキュメントセンター

CloudOps Orchestration Service:ACS-ECS-RunPacker

最終更新日:Jan 17, 2025

テンプレート名

ACS-ECS-RunPacker

今すぐ実行

テンプレートの説明

Elastic Compute Service ( ECS ) インスタンスでPacker テンプレートを実行します。

テンプレートの種類

自動化

所有者

Alibaba Cloud

入力パラメーター

パラメーター

説明

種類

必須

デフォルト値

制限

targets

Packer テンプレートを実行する ECS インスタンス。

String

はい

sourceType

ファイルを保存するサービスの種類。

String

はい

sourcePath

保存されているファイルの URL 。

String

はい

templateFile

実行するPacker テンプレートの名前。

String

はい

regionId

リージョン ID 。

String

いいえ

{{ ACS::RegionId }}

tokenInfo

ファイルをダウンロードするために使用されるトークン。

String

いいえ

mode

テンプレートを使用するモード。

String

いいえ

build

OOSAssumeRole

CloudOps Orchestration Service ( OOS ) によってアシュームされるResource Access Management ( RAM ) ロール。

String

いいえ

""

出力パラメーター

パラメーター

説明

種類

result

String

テンプレートの実行に必要な権限ポリシー

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

参照

詳細については、GitHub のACS-ECS-RunPacker.yml をご参照ください。

テンプレートコンテンツ

FormatVersion: OOS-2019-06-01
Description:
  en: Run packer template
  zh-cn: the description in Chinese
  name-en: ACS-ECS-RunPacker
  name-zh-cn: the description in Chinese
  categories:
    - image_manage
Parameters:
  regionId:
    Label:
      en: RegionId
      zh-cn: the description in Chinese
    Type: String
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  targets:
    Type: String
    Label:
      en: TargetInstance
      zh-cn: the description in Chinese
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  sourceType:
    Type: String
    Label:
      en: SourceType
      zh-cn: the description in Chinese
    AllowedValues:
      - oss
      - https
      - github
  sourcePath:
    Type: String
    Label:
      en: SourcePath
      zh-cn: the description in Chinese
  tokenInfo:
    Type: String
    Description:
      en: It is only required when downloading file from GitHub
      zh-cn: the description in Chinese
    Label:
      en: TokenInfo
      zh-cn: the description in Chinese
    Default: ' '
  templateFile:
    Label:
      en: TemplateFile
      zh-cn: the description in Chinese
    Type: String
  mode:
    Type: String
    Label:
      en: Mode
      zh-cn: the description in Chinese
    AllowedValues:
      - validate
      - fix
      - build
    Default: build
  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:
      instanceId:
        Type: String
        ValueSelector: Instances.Instance[].InstanceId
  - Name: runPacker
    Action: 'ACS::ECS::RunPacker'
    Description:
      en: Run packer template
      zh-cn: the description in Chinese
    Properties:
      regionId: '{{ regionId }}'
      instanceId: '{{ getInstance.instanceId }}'
      sourceType: '{{ sourceType }}'
      sourcePath: '{{ sourcePath }}'
      tokenInfo: '{{ tokenInfo }}'
      templateFile: '{{ templateFile }}'
      mode: '{{ mode }}'
    Outputs:
      commandOutput:
        Type: String
        ValueSelector: commandOutput
Outputs:
  result:
    Type: String
    Value: '{{ runPacker.commandOutput }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - sourceType
          - sourcePath
          - tokenInfo
          - templateFile
          - mode
        Label:
          default:
            zh-cn: the description in Chinese
            en: Parameters Options
      - Parameters:
          - regionId
          - targets
        Label:
          default:
            zh-cn: the description in Chinese
            en: Select ECS Instance
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            zh-cn: the description in Chinese
            en: Control Options