All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-RunPacker

Last Updated:Dec 24, 2025

Template name

ACS-ECS-RunPacker lets you execute Packer templates.

Execute Now

Template description

Execute the Packer template

Template type

Automated

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default value

Limit

targets

Target instance

String

Yes

sourceType

The type of the service that stores the file.

String

Yes

sourcePath

You must specify a URL to store the file.

String

Yes

templateFile

The name of the Packer template to be executed.

String

Yes

regionId

The region ID.

String

No

{{ ACS::RegionId }}

tokenInfo

The token that is used to download the file.

String

No

mode

The mode in which the template is used.

String

No

build

OOSAssumeRole

The Resource Access Management (RAM) role that is assumed by CloudOps Orchestration Service (OOS).

String

No

""

Output parameters

Parameter

Description

Type

result

String

Permission policy that is required to execute the template

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

Details

For details, see ACS-ECS-RunPacker.

Template content

FormatVersion: OOS-2019-06-01
Description:
  en: Run packer template
  zh-cn: Run Packer template
  name-en: ACS-ECS-RunPacker
  name-zh-cn: Run Packer template
  categories:
    - image_manage
Parameters:
  regionId:
    Label:
      en: RegionId
      zh-cn: Region ID
    Type: String
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  targets:
    Type: String
    Label:
      en: TargetInstance
      zh-cn: Target Instance
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  sourceType:
    Type: String
    Label:
      en: SourceType
      zh-cn: Type of file storage
    AllowedValues:
      - oss
      - https
      - github
  sourcePath:
    Type: String
    Label:
      en: SourcePath
      zh-cn: The URL of the file to be stored.
  tokenInfo:
    Type: String
    Description:
      en: It is only required when downloading file from GitHub
      zh-cn: This parameter is required only when you download a file from GitHub.
    Label:
      en: TokenInfo
      zh-cn: The token used to download the file.
    Default: ' '
  templateFile:
    Label:
      en: TemplateFile
      zh-cn: The name of the Packer template to be executed.
    Type: String
  mode:
    Type: String
    Label:
      en: Mode
      zh-cn: The mode in which to use the template.
    AllowedValues:
      - validate
      - fix
      - build
    Default: build
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: The RAM role to be assumed by OOS.
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: getInstance
    Description:
      en: Views the ECS instances
      zh-cn: Retrieves ECS instances.
    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: Runs the Packer template.
    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: Parameter Settings
            en: Parameters Options
      - Parameters:
          - regionId
          - targets
        Label:
          default:
            zh-cn: Select Instance
            en: Select ECS Instance
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Advanced Options
            en: Control Options