All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-RunPacker

Last Updated:Nov 14, 2024

Template name

ACS-ECS-RunPacker

Execute Now

Template description

Executes a Packer template on Elastic Compute Service (ECS) instances.

Template type

Automated

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default value

Limit

targets

The ECS instances on which you want to execute a Packer template.

String

Yes

sourceType

The type of the service that stores the file.

String

Yes

sourcePath

The URL to the stored 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"
        }
    ]
}

References

For more information, see ACS-ECS-RunPacker.yml at GitHub.

Template content

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