-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathACS-ECS-CreateImageAndUpdateLaunchTemplates.yml
160 lines (160 loc) · 5.02 KB
/
ACS-ECS-CreateImageAndUpdateLaunchTemplates.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
FormatVersion: OOS-2019-06-01
Description:
name-en: ACS-ECS-CreateImageAndUpdateLaunchTemplates
name-zh-cn: 创建ECS镜像并更新启动模板
en: Creates an ECS image and update launch template
zh-cn: 创建ECS镜像并更新启动模板
categories:
- image_manage
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: 地域ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
instanceId:
Label:
en: InstanceId
zh-cn: ECS实例ID
Type: String
AssociationProperty: ALIYUN::ECS::Instance::InstanceId
AssociationPropertyMetadata:
RegionId: regionId
targetImageName:
Label:
en: TargetImageName
zh-cn: 新镜像的名称
Type: String
Description:
en: <p class="p">Note:</p> <ul class="ul"> <li class="li">Length is 2~128 English or Chinese characters</li> <li class="li"><font color='red'>must start with big or small letters or Chinese, not http:// and https://. </font></li> <li class="li">Can contain numbers, colons (:), underscores (_), or dashes (-). </li> </ul>
zh-cn: <p class="p">注意:</p> <ul class="ul"> <li class="li">长度为2~128个英文或中文字符</li> <li class="li"><font color='red'>必须以大小字母或中文开头,不能以http://和https://开头。</font></li> <li class="li">可以包含数字、半角冒号(:)、下划线(_)或者短划线(-)。</li> </ul>
Default: CreateImage_from_{{instanceId}}
launchTemplateNames:
Description:
en: <font color='red'><b>Must correspond to the selected region</b></font>
zh-cn: <font color='red'><b>必须要在所选的地域</b></font>
Label:
en: LaunchTemplateNames
zh-cn: 待更新的实例启动模板名称列表
Type: List
Default: []
tags:
Label:
en: Tags
zh-cn: 镜像标签
Type: Json
AssociationProperty: Tags
AssociationPropertyMetadata:
ShowSystem: false
Default: []
deleteSourceTemplateVersion:
Label:
en: DeleteSourceTemplateVersion
zh-cn: 删除启动模板的原版本
Type: Boolean
Default: true
rateControl:
Label:
en: RateControl
zh-cn: 任务执行的并发比率
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 5
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: OOS扮演的RAM角色
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: createImage
Action: 'ACS::ECS::CreateImage'
Description:
en: Create new image with the specified image name and instance ID
zh-cn: 通过指定实例ID和镜像名称创建新的镜像
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ instanceId }}'
imageName: '{{ targetImageName }}_on_{{ ACS::ExecutionId }}_at_{{ Acs::CurrentDate }}'
tags: '{{tags}}'
Outputs:
imageId:
ValueSelector: imageId
Type: String
- Name: describeDisks
Action: 'ACS::ExecuteAPI'
Description:
en: Get disk info of the ECS instance
zh-cn: 查看实例的磁盘信息
Properties:
Service: ECS
API: DescribeDisks
Parameters:
RegionId: '{{ regionId }}'
InstanceId: '{{ instanceId }}'
Outputs:
systemDiskSize:
Type: String
ValueSelector: '.Disks.Disk[] | select(.Type == "system" )|.Size'
systemDiskPerformanceLevel:
Type: String
ValueSelector: '.Disks.Disk[] | select(.Type == "system" )|.PerformanceLevel'
systemDiskDeleteWithInstance:
Type: Boolean
ValueSelector: '.Disks.Disk[] | select(.Type == "system" )|.DeleteWithInstance'
- Name: updateLaunchTemplate
Action: 'ACS::ECS::UpdateLaunchTemplate'
Description:
en: Update instance launch template
zh-cn: 更新实例启动模板
Properties:
regionId: '{{ regionId }}'
imageId: '{{ createImage.imageId }}'
launchTemplateName: '{{ ACS::TaskLoopItem }}'
deleteSourceTemplateVersion: '{{ deleteSourceTemplateVersion }}'
systemDiskSize: '{{ describeDisks.systemDiskSize}}'
systemDiskPerformanceLevel: '{{ describeDisks.systemDiskPerformanceLevel }}'
systemDiskDeleteWithInstance: '{{ describeDisks.systemDiskDeleteWithInstance }}'
Loop:
Items: '{{ launchTemplateNames }}'
Outputs:
imageIds:
Type: List
Value: '{{ createImage.imageId }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- regionId
- instanceId
Label:
default:
zh-cn: 选择实例
en: Select Ecs Instances
- Parameters:
- targetImageName
- tags
Label:
default:
zh-cn: 镜像设置
en: Image Configure
- Parameters:
- launchTemplateNames
- deleteSourceTemplateVersion
Label:
default:
zh-cn: 启动模板
en: Launch Template
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: 高级选项
en: Control Options