-
Notifications
You must be signed in to change notification settings - Fork 35
/
mount-multiple-noninit-data-disks.yml
610 lines (577 loc) · 18.5 KB
/
mount-multiple-noninit-data-disks.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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建ECS实例,配置弹性IP,挂载2个数据盘,设置网络环境与安全组规则。
en: Create an ECS instance, configure elastic IP, mount 2 data disks, and set network environment and security group rules.
Parameters:
ZoneId:
Type: String
Label:
en: VSwitch Availability Zone
zh-cn: 交换机可用区
Description:
en: Availability Zone ID.<br><b>note:<font color='blue'>before selecting, please
confirm that the Availability Zone supports the specification of creating
ECS resources,which is recommended to be different from other VSwitch Availability
Zone</font></b>
zh-cn: 可用区ID。<br><b>注: <font color='blue'>选择前请确认该可用区是否支持创建ECS资源的规格,建议与其他交换机可用区不同</font></b>
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
VpcName:
Type: String
Label:
en: VPC Name
zh-cn: 专有网络名称
Description:
en: Name of VPC, [2, 128] English or Chinese characters, must start with a letter
or Chinese in size, can contain numbers, '_' or '.', '-'.
zh-cn: VPC 名称,[2,128]英文或中文字符,必须以字母或中文开头,可以包含数字、下划线或“.”、“-”。
ConstraintDescription:
en: '[2, 128] English or Chinese characters'
zh-cn: '[2, 128] 英文或中文字符'
Default: MyVPC
MinLength: 2
MaxLength: 128
VpcCidrBlock:
Type: String
Label:
en: VPC CIDR Block
zh-cn: 专有网络网段
Description:
en: New proprietary network IP address segment range, recommended use of the
following IP address segments<br><font color='green'>[10.0.0.0/8]</font><br><font
color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>
zh-cn: 新建专有网络IP地址段范围,推荐使用以下的IP地址段<br><font color='green'>[10.0.0.0/8]</font><br><font
color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>
Default: 192.168.0.0/16
AllowedValues:
- 192.168.0.0/16
- 172.16.0.0/12
- 10.0.0.0/8
VSwitchCidrBlock:
Type: String
Label:
en: VSwitch CIDR Block
zh-cn: 交换机网段
Description:
en: Network segments of new switches, subnets of virtual proprietary networks
zh-cn: 新建交换机的网段,所属虚拟专有网络的子网
Default: 192.168.0.0/24
SecurityGroupName:
Type: String
Label:
en: Security Group Name
zh-cn: 安全组名称
Description:
en: The security group name, [2, 128] English or Chinese characters, must start
with a letter or Chinese in size, can contain numbers, '_' or '.', '-'.
zh-cn: 安全组名,[2,128]英文或中文字符,必须以字母或中文开头,可以包含数字、下划线或“.”、“-”。
Default: mysecuritygroup
ImageId:
Type: String
Label:
en: Image ID
zh-cn: 镜像ID
Description:
en: Image ID,See detail:<b><a href='https://www.alibabacloud.com/help/doc-detail/112977.html'
target='_blank'><font color='blue'>Find the mirror</font></a></b>
zh-cn: 镜像ID, 详见:<b><a href='https://help.aliyun.com/document_detail/112977.html'
target='_blank'><font color='blue'>查找镜像</font></a></b>
AssociationProperty: ALIYUN::ECS::Image::ImageId
AssociationPropertyMetadata:
InstanceType: ${InstanceType}
SupportedImageOwnerAlias:
- system
- self
- others
Default: centos_7_04_64_20G_alibase_201701015.vhd
InstanceType:
Type: String
Label:
en: Instance Type
zh-cn: 实例规格
Description:
en: <font color='blue'><b>1.Before selecting the model please confirm that the
current available zone under the model is in stock, some models need to be
reported in advance</b></font><br><font color='blue'><b>2.List of optional
models</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU 4GiB Intranet
bandwidth1Gbps In-grid sending and receiving packages30MillionPPS</font>]<br></b>[ecs.c5.xlarge
<font color='green'>4vCPU 8GiB Intranet bandwidth1.5Gbps In-grid sending and
receiving packages50MillionPPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU
16GiB Intranet bandwidth2.5Gbps In-grid sending and receiving packages80MillionPPS</font>]
zh-cn: <font color='blue'><b>1.选择机型前请先确认当前可用区下该机型是否有货,部分机型需要提前报备</b></font><br><font
color='blue'><b>2.可选机型列表</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU
4GiB 内网带宽1Gbps 内网收发包30万PPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU
8GiB 内网带宽1.5Gbps 内网收发包50万PPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU
16GiB 内网带宽2.5Gbps 内网收发包80万PPS</font>]
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ZoneId
FirstDataDiskName:
Type: String
Label:
en: First Data Disk Name
zh-cn: 数据盘1的磁盘名称
Description:
en: First Data Disk Name, [2, 128] English or Chinese characters, must start
with a letter or Chinese in size, can contain numbers, '_' or '.', '-'.
zh-cn: 数据盘1的磁盘名称,[2,128]英文或中文字符,必须以字母或中文开头,可以包含数字、下划线或“.”、“-”。
ConstraintDescription:
en: '[2, 128] English or Chinese characters'
zh-cn: '[2, 128] 英文或中文字符'
Default: DataDisk_1
MinLength: 2
MaxLength: 128
FirstDataDiskSize:
Type: Number
Label:
en: First Data Disk Size
zh-cn: 数据盘1的磁盘名称
Description:
en: 'The size of the first volume, unit in GB.Value range: cloud: [5,2000],
cloud_efficiency: [20,32768], cloud_ssd: [20,32768], ephemeral_ssd: [5,800].The
value should be equal to or greater than the specific snapshot.'
zh-cn: 第一个数据盘的大小,单位为GB。值范围:cloud:[5,2000]、cloud_efficiency:[20,32768]、cloud_ssd:[20,32768]、ephemeral_ssd:[5,800]。该值应等于或大于特定快照。
Default: 40
FirstDataDiskCategory:
Type: String
Label:
en: First Data Disk Category
zh-cn: 数据盘1的磁盘类别
AssociationProperty: ALIYUN::ECS::Disk::DataDiskCategory
AssociationPropertyMetadata:
InstanceType: ${InstanceType}
ZoneId: ${ZoneId}
SecondDataDiskName:
Type: String
Label:
en: Second Data Disk Name
zh-cn: 数据盘2的磁盘名称
Description:
en: Second Data Disk Name, [2, 128] English or Chinese characters, must start
with a letter or Chinese in size, can contain numbers, '_' or '.', '-'.
zh-cn: 数据盘2的磁盘名称,[2,128]英文或中文字符,必须以字母或中文开头,可以包含数字、下划线或“.”、“-”。
Default: DataDisk_2
SecondDataDiskCategory:
Type: String
Label:
en: Second Data Disk Category
zh-cn: 数据盘2的磁盘类别
AssociationProperty: ALIYUN::ECS::Disk::DataDiskCategory
AssociationPropertyMetadata:
InstanceType: ${InstanceType}
ZoneId: ${ZoneId}
SecondDataDiskSize:
Type: Number
Label:
en: Second Data Disk Size
zh-cn: 数据盘2的磁盘大小
Description:
en: 'The size of the Second volume, unit in GB.Value range: cloud: [5,2000],
cloud_efficiency: [20,32768], cloud_ssd: [20,32768], ephemeral_ssd: [5,800].The
value should be equal to or greater than the specific snapshot.'
zh-cn: 第二个数据盘的大小,单位为GB。值范围:cloud:[5,2000]、cloud_efficiency:[20,32768]、cloud_ssd:[20,32768]、ephemeral_ssd:[5,800]。该值应等于或大于特定快照。
Default: 40
SystemDiskDiskName:
Type: String
Label:
en: System Disk Name
zh-cn: 系统盘名称
Description:
en: Name of created system disk, [2, 128] English or Chinese characters, must
start with a letter or Chinese in size, can contain numbers, '_' or '.', '-'.
zh-cn: 创建的系统磁盘的名称,[2,128]英文或中文字符,必须以字母或中文开头,可以包含数字、下划线或“.”、“-”。
Default: SystemDisk
SystemDiskSize:
Type: Number
Label:
en: System Disk Space
zh-cn: 系统盘大小
Description:
en: 'Disk size of the system disk, unit in GB.Value range: cloud: [5,2000],
cloud_efficiency: [20,32768], cloud_ssd: [20,32768], ephemeral_ssd: [5,800].The
value should be equal to or greater than the specific snapshot.'
zh-cn: 系统盘的大小,单位为GB。值范围:cloud:[5,2000]、cloud_efficiency:[20,32768]、cloud_ssd:[20,32768]、ephemeral_ssd:[5,800]。该值应等于或大于特定快照。
Default: 40
SystemDiskCategory:
Type: String
Label:
en: System Disk Type
zh-cn: 系统盘类型
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
InstanceType: InstanceType
ZoneId: ZoneId
Password:
Type: String
Label:
en: Instance Password
zh-cn: 实例密码
Description:
en: Server login password, Length 8-30, must contain three(Capital letters,
lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol
in).
zh-cn: 服务器登录密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。
ConstraintDescription:
en: 'Length 8-30, must contain upper case letters, lower case letters, Numbers,
special symbols three; special characters include: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
zh-cn: 长度8-30,必须包含大写字母、小写字母、数字、特殊符号三种;特殊字符包括:()`~!@#$%^&*_-+=|{}[]:;' <>,.?/
AllowedPattern: '[a-zA-Z0-9-\(\)\`\~\!@\#\$%\^&\*-+=\|\{\}\[\]\:\;\‘\,\.\?\/]*'
MinLength: 8
MaxLength: 30
NoEcho: true
Resources:
NewEip:
Type: ALIYUN::VPC::EIP
Properties:
Bandwidth: 1
InternetChargeType: PayByTraffic
Metadata:
ALIYUN::ROS::Designer:
id: a914d36e-d429-46d6-bbd0-a22acd07b096
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock:
Ref: VpcCidrBlock
VpcName:
Ref: VpcName
Metadata:
ALIYUN::ROS::Designer:
id: adfdd097-9c30-49ff-8738-ae3b59eada43
SecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: Vpc
SecurityGroupName:
Ref: SecurityGroupName
Metadata:
ALIYUN::ROS::Designer:
id: fde92bb4-877d-4e7b-b9dd-be6f5e552544
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: ZoneId
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
CidrBlock:
Ref: VSwitchCidrBlock
Metadata:
ALIYUN::ROS::Designer:
id: bd814869-3bd7-4551-a5db-0ec7ad3d3246
WebServer:
Type: ALIYUN::ECS::Instance
Properties:
VpcId:
Ref: Vpc
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Ref: SecurityGroup
ImageId:
Ref: ImageId
AllocatePublicIP: 'false'
DiskMappings:
- Category:
Ref: FirstDataDiskCategory
DiskName:
Ref: FirstDataDiskName
Size:
Ref: FirstDataDiskSize
- Category:
Ref: SecondDataDiskCategory
DiskName:
Ref: SecondDataDiskName
Size:
Ref: SecondDataDiskSize
InstanceType:
Ref: InstanceType
IoOptimized: optimized
Password:
Ref: Password
SystemDiskCategory:
Ref: SystemDiskCategory
SystemDiskDiskName:
Ref: SystemDiskDiskName
SystemDiskSize:
Ref: SystemDiskSize
UserData:
Fn::Join:
- ''
- - '#!/bin/sh
'
- 'logs=~/mount_logs
'
- 'i=1
'
- 'total=2
'
- 'while [ $i -le $total ]
'
- 'do
'
- ' disk_suffix=`echo $i|awk ''{printf "%c", 97+$i}''`
'
- 'fdisk -S 56 /dev/vd$disk_suffix <<ESXU
'
- 'n
'
- 'p
'
- '1
'
- '
'
- '
'
- 'w
'
- 'ESXU
'
- ' echo "/dev/vd$disk_suffix is fdisked!" >> $logs
'
- ' mkfs.ext4 /dev/vd${disk_suffix}1
'
- ' if [ $? -eq 0 ];then
'
- ' echo "/dev/vd${disk_suffix}1 is formated!" >> $logs
'
- ' fi
'
- ' touch ~/test_ftab
'
- ' mkdir $disk_suffix$i
'
- ' disk_uuid=`blkid | grep /dev/vd${disk_suffix}1 |awk ''{printf $2}''|sed
''s/\"//g''`
'
- 'cat << ESXU > ~/test_ftab
'
- '$disk_uuid $disk_suffix$i ext4 defaults 0
0
'
- 'ESXU
'
- ' cat ~/test_ftab >> /etc/fstab
'
- ' mount -a
'
- ' chmod -R 777 $disk_suffix$i
'
- ' rm -rf ~/test_ftab
'
- ' echo "/dev/vd${disk_suffix}1 is mounted!" >> $logs
'
- ' let i+=1
'
- 'done
'
Metadata:
ALIYUN::ROS::Designer:
id: 4f476130-0cde-4cff-a973-2cb026e18f13
EIPBind:
Type: ALIYUN::VPC::EIPAssociation
Properties:
InstanceId:
Ref: WebServer
AllocationId:
Ref: NewEip
Metadata:
ALIYUN::ROS::Designer:
id: ece3b051-66c9-46d6-9961-f184d342b21f
SecurityGroupEgress:
Type: ALIYUN::ECS::SecurityGroupEgress
Properties:
SecurityGroupId:
Ref: SecurityGroup
DestCidrIp: 0.0.0.0/0
IpProtocol: all
NicType: intranet
PortRange: -1/-1
Metadata:
ALIYUN::ROS::Designer:
id: faa26b3c-3507-41e9-9959-5db9a9e67446
SecurityGroupIngress:
Type: ALIYUN::ECS::SecurityGroupIngress
Properties:
SecurityGroupId:
Ref: SecurityGroup
IpProtocol: all
NicType: intranet
PortRange: -1/-1
SourceCidrIp: 0.0.0.0/0
Metadata:
ALIYUN::ROS::Designer:
id: 2a6cfdef-e236-4966-a976-dd7e7bbc37a5
Outputs:
InstanceId:
Description: The instance id of created ecs instance.
Value:
Fn::GetAtt:
- WebServer
- InstanceId
NewEipId:
Description: ID that Aliyun assigns to represent the allocation of the address
for use with VPC. Returned only for VPC elastic IP addresses.
Value:
Fn::GetAtt:
- NewEip
- AllocationId
SecurityGroupId:
Description: generated security group id for security group.
Value:
Fn::GetAtt:
- SecurityGroup
- SecurityGroupId
VSwitchId:
Description: Id of created VSwitch.
Value:
Fn::GetAtt:
- VSwitch
- VSwitchId
VpcId:
Description: Id of created VPC.
Value:
Fn::GetAtt:
- Vpc
- VpcId
ZoneId:
Description: Zone ID of created instance.
Value:
Fn::GetAtt:
- WebServer
- ZoneId
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- ZoneId
- VpcName
- VpcCidrBlock
- VSwitchCidrBlock
- SecurityGroupName
Label:
default:
en: Infrastructure Configuration
zh-cn: 基础资源配置(必填)
- Parameters:
- InstanceType
- ImageId
- FirstDataDiskName
- FirstDataDiskSize
- FirstDataDiskCategory
- SecondDataDiskName
- SecondDataDiskCategory
- SecondDataDiskSize
- SystemDiskDiskName
- SystemDiskSize
- SystemDiskCategory
- Password
Label:
default:
en: ECS Configuration
zh-cn: ECS 配置(必填)
TemplateTags:
- acs:example:弹性计算:创建ECS和弹性IP并挂载多个数据盘
ALIYUN::ROS::Designer:
1a055b4d-5cbc-4a89-8429-682c80ffbf1a:
source:
id: ece3b051-66c9-46d6-9961-f184d342b21f
target:
id: a914d36e-d429-46d6-bbd0-a22acd07b096
z: 1
2a6cfdef-e236-4966-a976-dd7e7bbc37a5:
position:
x: 569
y: 246
size:
height: 60
width: 60
z: 0
4475ae04-e83f-45e5-b884-c2373bcc6d06:
source:
id: ece3b051-66c9-46d6-9961-f184d342b21f
target:
id: 4f476130-0cde-4cff-a973-2cb026e18f13
z: 1
4f476130-0cde-4cff-a973-2cb026e18f13:
position:
x: 250
y: 130
size:
height: 60
width: 60
z: 2
694b3bb1-0bd9-41a1-aaa5-0c638119bb02:
source:
id: 2a6cfdef-e236-4966-a976-dd7e7bbc37a5
target:
id: fde92bb4-877d-4e7b-b9dd-be6f5e552544
z: 1
a914d36e-d429-46d6-bbd0-a22acd07b096:
position:
x: 713
y: 130
size:
height: 60
width: 60
z: 0
adfdd097-9c30-49ff-8738-ae3b59eada43:
embeds:
- bd814869-3bd7-4551-a5db-0ec7ad3d3246
- fde92bb4-877d-4e7b-b9dd-be6f5e552544
position:
x: 191
y: 50
size:
height: 288
width: 312
z: 0
bd814869-3bd7-4551-a5db-0ec7ad3d3246:
embeds:
- 4f476130-0cde-4cff-a973-2cb026e18f13
position:
x: 211
y: 90
size:
height: 140
width: 120
z: 1
d3d67b13-7b43-4617-9a57-91d0ab7fe4d9:
source:
id: 4f476130-0cde-4cff-a973-2cb026e18f13
target:
id: fde92bb4-877d-4e7b-b9dd-be6f5e552544
z: 1
ece3b051-66c9-46d6-9961-f184d342b21f:
position:
x: 557
y: 130
size:
height: 60
width: 60
z: 0
f2f7c4cf-0b0f-4944-aae8-f8b534ab6533:
source:
id: faa26b3c-3507-41e9-9959-5db9a9e67446
target:
id: fde92bb4-877d-4e7b-b9dd-be6f5e552544
z: 1
faa26b3c-3507-41e9-9959-5db9a9e67446:
position:
x: 397
y: 370
size:
height: 60
width: 60
z: 0
fde92bb4-877d-4e7b-b9dd-be6f5e552544:
position:
x: 397
y: 246
size:
height: 60
width: 60
z: 1