Template name
ACS-ECS-RunPacker lets you execute Packer templates.
Template description
Executes a Packer template on the specified ECS instances.
Template type
Automated
Owner
Alibaba Cloud
Input parameters
|
Parameter |
Description |
Type |
Required |
Default value |
Limit |
|
targets |
The target ECS instances. |
String |
Yes |
||
|
sourceType |
The type of service that stores the file. |
String |
Yes |
||
|
sourcePath |
The URL of the file storage location. |
String |
Yes |
||
|
templateFile |
The name of the Packer template to execute. |
String |
Yes |
||
|
regionId |
The region ID. |
String |
No |
{{ ACS::RegionId }} |
|
|
tokenInfo |
The token used to download the file. |
String |
No |
||
|
mode |
The execution mode for the template. |
String |
No |
build |
|
|
OOSAssumeRole |
The Resource Access Management (RAM) role 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