-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS::ECS::UpdateLaunchTemplate.yml
333 lines (331 loc) · 13.8 KB
/
ACS::ECS::UpdateLaunchTemplate.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
FormatVersion: OOS-2019-06-01
Description:
name-en: ACS::ECS::UpdateLaunchTemplate
name-zh-cn: 更新启动模板
en: Update the launch template
zh-cn: 更新启动模板
Parameters:
regionId:
Description:
en: The ID of region
zh-cn: 地域ID
Type: String
Default: '{{ ACS::RegionId }}'
imageId:
Description:
en: The image ID of the launch template to update
zh-cn: 要将启动模板默认版本的镜像ID更新成的值
Type: String
launchTemplateName:
Description:
en: The name of the launch template
zh-cn: 要更新的启动模板名称
Type: String
deleteSourceTemplateVersion:
Description:
en: delete launch template source version or not,the default is true
zh-cn: 删除启动模板的原版本
Type: Boolean
Default: true
AllowedValues:
- false
- true
systemDiskSize:
Description:
en: System disk size to update launch template
zh-cn: 用于更新的启动模板的系统盘大小
Type: String
Default: ''
systemDiskPerformanceLevel:
Description:
en: System disk performance level to update launch template
zh-cn: 设置系统盘的性能等级
Type: String
Default: ''
systemDiskDeleteWithInstance:
Description:
en: Whether the system disk will be deleted with the instance
zh-cn: 系统盘是否随实例释放
Type: String
Default: ''
Tasks:
- Name: describeLaunchTemplates
Action: ACS::ExecuteAPI
Description:
en: Query launch default template version
zh-cn: 查询启动模板的版本号
Properties:
Service: ECS
API: DescribeLaunchTemplates
Parameters:
RegionId: '{{ regionId }}'
LaunchTemplateName:
- '{{ launchTemplateName }}'
Outputs:
defaultVersionNumber:
Type: List
ValueSelector: '.LaunchTemplateSets.LaunchTemplateSet[].DefaultVersionNumber'
- Name: checkWhetherLaunchTemplateExist
Action: ACS::Choice
Description:
en: Checks whether the launch template exists
zh-cn: 检查启动模板是否存在
Properties:
DefaultTask: describeLaunchTemplateVersions
Choices:
- When:
Fn::Equals:
- []
- '{{ describeLaunchTemplates.defaultVersionNumber }}'
NextTask: ACS::END
- Name: describeLaunchTemplateVersions
Action: ACS::ExecuteAPI
Description:
en: Query the content of launch template default version
zh-cn: 查询启动模板默认版本的内容
Properties:
Service: ECS
API: DescribeLaunchTemplateVersions
Parameters:
RegionId: '{{ regionId }}'
LaunchTemplateName: '{{ launchTemplateName }}'
LaunchTemplateVersion: '{{describeLaunchTemplates.defaultVersionNumber}}'
Outputs:
imageOwnerAlias:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.ImageOwnerAlias'
description:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.Description'
resourceGroupId:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.ResourceGroupId'
dataDisks:
Type: List
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.DataDisks.DataDisk[]'
userData:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.UserData'
instanceChargeType:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.InstanceChargeType'
spotDuration:
Type: Number
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.SpotDuration'
systemDiskSize:
Type: Number
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData| getpath([ "SystemDisk.Size" ])'
systemDiskPerformanceLevel:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData| getpath([ "SystemDisk.PerformanceLevel" ])'
systemDiskDeleteWithInstance:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData| getpath([ "SystemDisk.DeleteWithInstance" ])'
ramRoleName:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.RamRoleName'
networkType:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.NetworkType'
networkInterfaces:
Type: List
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.NetworkInterfaces.NetworkInterface[]'
spotPriceLimit:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.SpotPriceLimit'
systemDiskCategory:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData| getpath([ "SystemDisk.Category" ])'
instanceType:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.InstanceType'
hostName:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.HostName'
spotStrategy:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.SpotStrategy'
tags:
Type: List
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.Tags.InstanceTag[]'
keyPairName:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.KeyPairName'
ioOptimized:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.IoOptimized'
zoneId:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.ZoneId'
securityGroupId:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.SecurityGroupId'
vSwitchId:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.VSwitchId'
internetChargeType:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.InternetChargeType'
instanceName:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.InstanceName'
internetMaxBandwidthOut:
Type: Number
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.InternetMaxBandwidthOut'
internetMaxBandwidthIn:
Type: Number
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.InternetMaxBandwidthIn'
vpcId:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.VpcId'
versionDescription:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].VersionDescription'
securityEnhancementStrategy:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.SecurityEnhancementStrategy'
passwordInherit:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.PasswordInherit'
autoReleaseTime:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.AutoReleaseTime'
period:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.Period'
systemDiskDescription:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData| getpath([ "SystemDisk.Description" ])'
systemDiskDiskName:
Type: String
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData| getpath([ "SystemDisk.DiskName" ])'
securityGroupIds:
Type: Json
ValueSelector: '.LaunchTemplateVersionSets.LaunchTemplateVersionSet[].LaunchTemplateData.SecurityGroupIds'
- Name: createLaunchTemplateVersion
Action: ACS::ExecuteAPI
Description:
en: Create launch template new version
zh-cn: 创建启动模板的新版本
Properties:
Service: ECS
API: CreateLaunchTemplateVersion
Parameters:
LaunchTemplateName: '{{launchTemplateName}}'
RegionId: '{{regionId}}'
VersionDescription: '{{describeLaunchTemplateVersions.versionDescription}}'
ImageId: '{{ imageId }}'
VpcId: '{{describeLaunchTemplateVersions.vpcId}}'
ImageOwnerAlias: '{{ describeLaunchTemplateVersions.imageOwnerAlias }}'
Description: '{{ describeLaunchTemplateVersions.description }}'
ResourceGroupId: '{{ describeLaunchTemplateVersions.resourceGroupId }}'
UserData: '{{ describeLaunchTemplateVersions.userData }}'
InstanceChargeType: '{{ describeLaunchTemplateVersions.instanceChargeType }}'
SpotDuration: '{{ describeLaunchTemplateVersions.spotDuration }}'
SystemDiskSize:
Fn::If:
- Fn::Equals:
- '{{ systemDiskSize }}'
- ''
- '{{ describeLaunchTemplateVersions.systemDiskSize }}'
- '{{ systemDiskSize }}'
SystemDiskPerformanceLevel:
Fn::If:
- Fn::Equals:
- '{{ systemDiskPerformanceLevel }}'
- ''
- '{{ describeLaunchTemplateVersions.systemDiskPerformanceLevel }}'
- '{{ systemDiskPerformanceLevel }}'
SystemDiskDeleteWithInstance:
Fn::If:
- Fn::Equals:
- '{{ systemDiskDeleteWithInstance }}'
- ''
- '{{ describeLaunchTemplateVersions.systemDiskDeleteWithInstance }}'
- '{{ systemDiskDeleteWithInstance }}'
RamRoleName: '{{ describeLaunchTemplateVersions.ramRoleName }}'
NetworkType: '{{ describeLaunchTemplateVersions.networkType }}'
NetworkInterfaces: '{{ describeLaunchTemplateVersions.networkInterfaces }}'
SpotPriceLimit: '{{ describeLaunchTemplateVersions.spotPriceLimit }}'
SystemDiskCategory: '{{ describeLaunchTemplateVersions.systemDiskCategory }}'
InstanceType: '{{ describeLaunchTemplateVersions.instanceType }}'
HostName: '{{ describeLaunchTemplateVersions.hostName }}'
SpotStrategy: '{{ describeLaunchTemplateVersions.spotStrategy }}'
Tags: '{{ describeLaunchTemplateVersions.tags }}'
KeyPairName: '{{ describeLaunchTemplateVersions.keyPairName }}'
IoOptimized: '{{ describeLaunchTemplateVersions.ioOptimized }}'
ZoneId: '{{ describeLaunchTemplateVersions.zoneId }}'
SecurityGroupId: '{{ describeLaunchTemplateVersions.securityGroupId }}'
VSwitchId: '{{ describeLaunchTemplateVersions.vSwitchId }}'
InternetChargeType: '{{ describeLaunchTemplateVersions.internetChargeType }}'
InstanceName: '{{ describeLaunchTemplateVersions.instanceName }}'
InternetMaxBandwidthOut: '{{ describeLaunchTemplateVersions.internetMaxBandwidthOut }}'
InternetMaxBandwidthIn: '{{ describeLaunchTemplateVersions.internetMaxBandwidthIn }}'
SecurityEnhancementStrategy: '{{ describeLaunchTemplateVersions.securityEnhancementStrategy }}'
PasswordInherit: '{{ describeLaunchTemplateVersions.passwordInherit }}'
SystemDiskDescription: '{{ describeLaunchTemplateVersions.systemDiskDescription }}'
AutoReleaseTime: '{{ describeLaunchTemplateVersions.autoReleaseTime }}'
SystemDiskDiskName: '{{ describeLaunchTemplateVersions.systemDiskDiskName }}'
Period: '{{ describeLaunchTemplateVersions.period }}'
SecurityGroupIds:
'Fn::If':
- 'Fn::Equals':
- Null
- '{{ describeLaunchTemplateVersions.securityGroupIds }}'
- Null
- 'Fn::Select':
- "SecurityGroupId"
- '{{ describeLaunchTemplateVersions.securityGroupIds }}'
Outputs:
launchTemplateVersionNumber:
Type: String
ValueSelector: LaunchTemplateVersionNumber
- Name: modifyLaunchTemplateDefaultVersion
Action: ACS::ExecuteAPI
Description:
en: Modify launch template default version
zh-cn: 更改启动模板的默认版本
Properties:
Service: ECS
API: ModifyLaunchTemplateDefaultVersion
Parameters:
RegionId: '{{ regionId }}'
LaunchTemplateName: '{{ launchTemplateName }}'
DefaultVersionNumber: '{{ createLaunchTemplateVersion.launchTemplateVersionNumber }}'
- Name: waitModifyLaunchTemplateDefaultVersionSuccess
Action: ACS::WaitFor
OnSuccess: deleteLaunchTemplateVersion
Description:
en: Waits for modifying launch template default version success
zh-cn: 等待启动模板默认版本更改成功
Retries: 7
Properties:
Service: ECS
API: DescribeLaunchTemplates
Parameters:
RegionId: '{{ regionId }}'
LaunchTemplateName:
- '{{ launchTemplateName }}'
DesiredValues:
- 'true'
PropertySelector: .LaunchTemplateSets.LaunchTemplateSet[].DefaultVersionNumber|tostring == "{{ createLaunchTemplateVersion.launchTemplateVersionNumber }}"|tostring
- Name: deleteLaunchTemplateVersion
Action: ACS::ExecuteAPI
When:
'Fn::Equals':
- '{{ deleteSourceTemplateVersion }}'
- true
Description:
en: Delete source launch template version
zh-cn: 删除启动模板原默认版本
Properties:
Service: ECS
API: DeleteLaunchTemplateVersion
Parameters:
RegionId: '{{ regionId }}'
LaunchTemplateName: '{{ launchTemplateName }}'
DeleteVersion: '{{describeLaunchTemplates.defaultVersionNumber}}'
Outputs:
defaultVersionNumber:
Type: String
Value: '{{ createLaunchTemplateVersion.launchTemplateVersionNumber }}'