forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jdk-dns-ssh-without-password-3-ecs.yml
763 lines (758 loc) · 29.6 KB
/
jdk-dns-ssh-without-password-3-ecs.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
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
ROSTemplateFormatVersion: '2015-09-01'
Description:
en: This template shows how to install and config a java jdk, domain name resolution
and ssh login without password environment on 3 ECS instances. This template can
be used as a start of other complex templates(like as hadoop and spark).
zh-cn: 此模板创建3台ECS实例,并安装和配置Java jdk,域名解析和ssh登录而无需密码环境。该模板可以用作其他复杂模板(例如hadoop和spark)的开始。
Parameters:
VpcCidrBlock:
Type: String
Label:
en: VPC CIDR Block
zh-cn: 专有网络网段
Description:
en: 'The IP address range of the VPC in the CIDR Block form; <br>you can use
the following IP address ranges and their subnets: <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: VPC的IP地址范围;<br>您可以使用以下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/16]</font>
Default: 192.168.0.0/16
AllowedValues:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
VSwitchCidrBlock:
Type: String
Label:
en: VSwitch CIDR Block
zh-cn: 交换机网段
Description:
en: CIDR Block of created VSwitch,It must belong to itself VPC CIDR Block.
zh-cn: 创建的虚拟交换机的子网,它必须属于自己的VPC网段内
Default: 192.168.1.0/24
ZoneId:
Type: String
Label:
en: Zone ID
zh-cn: 可用区
Description:
en: ECS Available Zone ID,</font><a href='https://www.alibabacloud.com/help/doc-detail/123712.html'
target='_blank'><b> View region and zone info</b><font color='blue'></a>.
zh-cn: ECS 可用区ID,</font><a href='https://help.aliyun.com/document_detail/123712.html'
target='_blank'><b> 查看可用区信息</b><font color='blue'></a>.
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
InstanceName:
Type: String
Label:
en: Instance Name
zh-cn: ECS实例名称
Description:
en: ECS Instance Name, [2, 128] English or Chinese characters, must start with
a letter or Chinese in size, can contain numbers, '_' or '.', '-'.
zh-cn: ECS实例名,[2,128]英文或中文字符,必须以字母或中文开头,可以包含数字、下划线或“.”、“-”。
ConstraintDescription:
en: '[2, 128] English or Chinese characters'
zh-cn: '[2, 128] 英文或中文字符'
Default: DefaultECSInstance
MinLength: 2
MaxLength: 128
ImageId:
Type: String
Label:
en: Image ID
zh-cn: ECS镜像
Description:
en: Image ID, represents the image resource to startup one ECS instance, <font><a
href='https://www.alibabacloud.com/help/doc-detail/112977.html' target='_blank'><b>View
image resources</b></font color='blue'></a>
zh-cn: 镜像ID,ECS实例的镜像资源, <font><a href='https://help.aliyun.com/document_detail/112977.html'
target='_blank'><b>查看镜像资源</b></font color='blue'></a>
Default: centos_7
InstanceType:
Type: String
Label:
en: Instance Type
zh-cn: ECS实例规格
Description:
en: The ECS instance type,go to the product console to ensure the current instance
is available, <font><a href='https://www.alibabacloud.com/help/doc-detail/25378.html'
target='_blank'><b>View instance types</b></font color='blue'></a>.
zh-cn: ECS实例类型,进入产品控制台确保当前实例可用, <font><a href='https://help.aliyun.com/document_detail/25378.html'
target='_blank'><b>查看实例类型</b></font color='blue'></a>
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ZoneId
Default: ecs.c5.large
SystemDiskCategory:
Type: String
Label:
en: Instance System Disk Category
zh-cn: ECS系统盘类型
Description:
en: '<font color=''blue''><b>Optional values:</b></font><br>[cloud_efficiency:
<font color=''green''>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color=''green''>SSD
Cloud Disk</font>]<br>[cloud_essd: <font color=''green''>ESSD Cloud Disk</font>]<br>[cloud:
<font color=''green''>Cloud Disk</font>]<br>[ephemeral_ssd: <font color=''green''>Local
SSD Cloud Disk</font>]'
zh-cn: '<font color=''blue''><b>可选值:</b></font><br>[cloud_efficiency: <font
color=''green''>高效云盘</font>]<br>[cloud_ssd: <font color=''green''>SSD云盘</font>]<br>[cloud_essd:
<font color=''green''>ESSD云盘</font>]<br>[cloud: <font color=''green''>普通云盘</font>]<br>[ephemeral_ssd:
<font color=''green''>本地SSD盘</font>]'
Default: cloud_ssd
AllowedValues:
- cloud_efficiency
- cloud_ssd
- cloud
- cloud_essd
- ephemeral_ssd
InstancePassword:
Type: String
Label:
en: Instance Password
zh-cn: ECS密码
Description:
en: The 8-30 long login password of instance, consists of the uppercase, lowercase
letter and number. <br> special characters include()'~!@#$%^&*_-+=|{}[]:;'<>,.?/.
zh-cn: 长度8-30,必须包含大写字母、小写字母、数字、特殊符号三个;<br>特殊字符包括:()'~!@#$%^&*_-+=|{}[]:;'<>,.?/
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:
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock:
Ref: VpcCidrBlock
VpcName: VpcName
Metadata:
ALIYUN::ROS::Designer:
id: 741f1552-fae5-48d1-8dc4-9bed0785644c
SecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: Vpc
SecurityGroupEgress:
- DestCidrIp: 0.0.0.0/0
IpProtocol: all
NicType: internet
PortRange: -1/-1
Priority: 1
SecurityGroupIngress:
- IpProtocol: all
NicType: internet
PortRange: -1/-1
Priority: 1
SourceCidrIp: 0.0.0.0/0
Metadata:
ALIYUN::ROS::Designer:
id: a7de7dea-6e2d-4d70-a27f-bb0db4417aa3
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: ZoneId
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
CidrBlock:
Ref: VSwitchCidrBlock
Metadata:
ALIYUN::ROS::Designer:
id: f809586c-bea7-4e43-8114-239bdd811004
Slave1:
Type: ALIYUN::ECS::Instance
Properties:
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Ref: SecurityGroup
ImageId:
Ref: ImageId
InstanceName:
Ref: InstanceName
InstanceType:
Ref: InstanceType
IoOptimized: optimized
Password:
Ref: InstancePassword
SystemDiskCategory:
Ref: SystemDiskCategory
UserData:
Fn::Replace:
- ros-notify:
Fn::GetAtt:
- Slave1ConditionHandle
- CurlCli
- Fn::Join:
- ''
- - "#!/bin/bash \n"
- "yum -y install java \n"
- "hostnamectl --static set-hostname 'slave1.hadoop' \n"
- "export HOME=/root \n"
- "export HOSTNAME=`hostname` \n"
- "ip_addr=`ifconfig eth0 | awk '/inet /{print $2}'` \n"
- "mkdir /usr/local/hadoop \n"
- "cd /root \n"
- "rm -rf .ssh \n"
- "ssh-keygen -t rsa -P '' -f '/root/.ssh/id_rsa' \n"
- "cd /root/.ssh \n"
- "rm -f * \n"
- "echo '-----BEGIN RSA PRIVATE KEY-----' > id_rsa \n"
- "echo 'MIIEowIBAAKCAQEAzfQ/QHwWB1njU9+Wu3RYi9g+g5rydSpAE0klefTJuZjtcaic'\
\ >> id_rsa \n"
- "echo 'SCeBN5avih8UToZ148+Ef2YzOtoosqluZpoYLCPSpAqr8pmviBJIU3vfu9mnDG9L'\
\ >> id_rsa \n"
- "echo 'oevT6K8w3wCBRCmqu+vc0Tpju/EeCuYK3+8w7e2I6F3+zIYzhhX3qmkocje7ACnV'\
\ >> id_rsa \n"
- "echo 'yh2DB/2m3sogTMc0RT+5y3kJAnC6TOIlGsYjOOkPbEF3Ifn1o4ZjOFOmQlcRJer4'\
\ >> id_rsa \n"
- "echo '1E6rTdXAxS2uDNMFBCf9Xyx7O9J+ELTCAXc4h7AE6WLdQb5Apzv4t1KswCAtRenP'\
\ >> id_rsa \n"
- "echo '1xGcUYY8I/JUT2VvBWtQJennrk9jrPZUFDcmcwIDAQABAoIBAAwzDZQaRYvF7UtI'\
\ >> id_rsa \n"
- "echo 'kTslVyFhe8J76SS7jfQWfxvMPi66OkZjQG6duG+8g0VhNei42j7WSfjp6trvlT2P'\
\ >> id_rsa \n"
- "echo '/7QgKJJkxNNmtmy2Ycljm9kmG0ibSePYq9g5ieHcjr6G3yFUfoKHJBtYpBO74pWu'\
\ >> id_rsa \n"
- "echo 'rrI5DuLpERUCjFc9E8w7fOIhPH4XZ6wk/EmPxHTgxZk+aMvqptyPSbUyiUOvCiZf'\
\ >> id_rsa \n"
- "echo 'MD0ircs9vgtslMVDlz9m6CoiNz6B3Yf6eLRoGGMiGnsQzZHIfnHCMX8i65Jc+TvQ'\
\ >> id_rsa \n"
- "echo 'fLopIHzwBwI55xpcOIBRgYiEAQJhLsSNSFugoxMcwe9RalTGGS21HOQu4b3ZylKM'\
\ >> id_rsa \n"
- "echo '8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yInc3Fm/sgJdbXQnUy+3QbbCcBCmcLj27LPQyxuu7p9hbPPT'\
\ >> id_rsa \n"
- "echo 'Mxx37OmYvOkSVTQz0T9HfDGvOJgt4t4cXD4T/7ewk62p6jdpSQrt' >> id_rsa\
\ \n"
- "echo '-----END RSA PRIVATE KEY-----' >> id_rsa \n"
- "echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDN9D9AfBYHWeNT35a7dFiL2D6DmvJ1KkATSSV59Mm5mO1xqJxIJ4E3lq+KHxROhnXjz4R/ZjM62iiyqW5mmhgsI9KkCqvyma+IEkhTe9+72acMb0uh69PorzDfAIFEKaq769zROmO78R4K5grf7zDt7YjoXf7MhjOGFfeqaShyN7sAKdXKHYMH/abeyiBMxzRFP7nLeQkCcLpM4iUaxiM46Q9sQXch+fWjhmM4U6ZCVxEl6vjUTqtN1cDFLa4M0wUEJ/1fLHs70n4QtMIBdziHsATpYt1BvkCnO/i3UqzAIC1F6c/XEZxRhjwj8lRPZW8Fa1Al6eeuT2Os9lQUNyZz\
\ root@iZ2zee53wf4ndvajz30cdvZ' > id_rsa.pub \n"
- "cp id_rsa.pub authorized_keys \n"
- "chmod 600 authorized_keys \n"
- "chmod 600 id_rsa \n"
- "sed -i 's/# StrictHostKeyChecking ask/StrictHostKeyChecking no/'\
\ /etc/ssh/ssh_config \n"
- "sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/' /etc/ssh/ssh_config\
\ \n"
- "service sshd restart \n"
- 'ros-notify -d ''{"data" : "Install Java and ssh without password."}''
'
Metadata:
ALIYUN::ROS::Designer:
id: 87df6ea5-8234-4e02-b093-bfe111d85772
Slave2:
Type: ALIYUN::ECS::Instance
Properties:
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Ref: SecurityGroup
ImageId:
Ref: ImageId
InstanceName:
Ref: InstanceName
InstanceType:
Ref: InstanceType
IoOptimized: optimized
Password:
Ref: InstancePassword
SystemDiskCategory:
Ref: SystemDiskCategory
UserData:
Fn::Replace:
- ros-notify:
Fn::GetAtt:
- Slave2ConditionHandle
- CurlCli
- Fn::Join:
- ''
- - "#!/bin/bash \n"
- "yum -y install java \n"
- "hostnamectl --static set-hostname 'slave2.hadoop' \n"
- "export HOME=/root \n"
- "export HOSTNAME=`hostname` \n"
- "ip_addr=`ifconfig eth0 | awk '/inet /{print $2}'` \n"
- "mkdir /usr/local/hadoop \n"
- "cd /root \n"
- "rm -rf .ssh \n"
- "ssh-keygen -t rsa -P '' -f '/root/.ssh/id_rsa' \n"
- "cd /root/.ssh \n"
- "rm -f * \n"
- "echo '-----BEGIN RSA PRIVATE KEY-----' > id_rsa \n"
- "echo 'MIIEowIBAAKCAQEAzfQ/QHwWB1njU9+Wu3RYi9g+g5rydSpAE0klefTJuZjtcaic'\
\ >> id_rsa \n"
- "echo 'SCeBN5avih8UToZ148+Ef2YzOtoosqluZpoYLCPSpAqr8pmviBJIU3vfu9mnDG9L'\
\ >> id_rsa \n"
- "echo 'oevT6K8w3wCBRCmqu+vc0Tpju/EeCuYK3+8w7e2I6F3+zIYzhhX3qmkocje7ACnV'\
\ >> id_rsa \n"
- "echo 'yh2DB/2m3sogTMc0RT+5y3kJAnC6TOIlGsYjOOkPbEF3Ifn1o4ZjOFOmQlcRJer4'\
\ >> id_rsa \n"
- "echo '1E6rTdXAxS2uDNMFBCf9Xyx7O9J+ELTCAXc4h7AE6WLdQb5Apzv4t1KswCAtRenP'\
\ >> id_rsa \n"
- "echo '1xGcUYY8I/JUT2VvBWtQJennrk9jrPZUFDcmcwIDAQABAoIBAAwzDZQaRYvF7UtI'\
\ >> id_rsa \n"
- "echo 'kTslVyFhe8J76SS7jfQWfxvMPi66OkZjQG6duG+8g0VhNei42j7WSfjp6trvlT2P'\
\ >> id_rsa \n"
- "echo '/7QgKJJkxNNmtmy2Ycljm9kmG0ibSePYq9g5ieHcjr6G3yFUfoKHJBtYpBO74pWu'\
\ >> id_rsa \n"
- "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ghxdmEozI6U5WA7CmdWUyObFXTPc/Z6FLXwqJ5IZ+CRt0neuIFNSA'\
\ >> id_rsa \n"
- "echo 'EQy9iFQ1FBUW06BRQpBns7yOg9jr6BOTxchjIV0I9caDp1nKRIrWU9NQ9iCFnYVA'\
\ >> id_rsa \n"
- "echo '7IsvQQKBgFxgF7UOhwaiMb/ATSuhm2v9kVvRPEO9umdo7YJ9I4L09lYbAtpcnusQ'\
\ >> id_rsa \n"
- "echo 'fIROYL25VeEMgYcQyInc3Fm/sgJdbXQnUy+3QbbCcBCmcLj27LPQyxuu7p9hbPPT'\
\ >> id_rsa \n"
- "echo 'Mxx37OmYvOkSVTQz0T9HfDGvOJgt4t4cXD4T/7ewk62p6jdpSQrt' >> id_rsa\
\ \n"
- "echo '-----END RSA PRIVATE KEY-----' >> id_rsa \n"
- "echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDN9D9AfBYHWeNT35a7dFiL2D6DmvJ1KkATSSV59Mm5mO1xqJxIJ4E3lq+KHxROhnXjz4R/ZjM62iiyqW5mmhgsI9KkCqvyma+IEkhTe9+72acMb0uh69PorzDfAIFEKaq769zROmO78R4K5grf7zDt7YjoXf7MhjOGFfeqaShyN7sAKdXKHYMH/abeyiBMxzRFP7nLeQkCcLpM4iUaxiM46Q9sQXch+fWjhmM4U6ZCVxEl6vjUTqtN1cDFLa4M0wUEJ/1fLHs70n4QtMIBdziHsATpYt1BvkCnO/i3UqzAIC1F6c/XEZxRhjwj8lRPZW8Fa1Al6eeuT2Os9lQUNyZz\
\ root@iZ2zee53wf4ndvajz30cdvZ' > id_rsa.pub \n"
- "cp id_rsa.pub authorized_keys \n"
- "chmod 600 authorized_keys \n"
- "chmod 600 id_rsa \n"
- "sed -i 's/# StrictHostKeyChecking ask/StrictHostKeyChecking no/'\
\ /etc/ssh/ssh_config \n"
- "sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/' /etc/ssh/ssh_config\
\ \n"
- "service sshd restart \n"
- 'ros-notify -d ''{"data" : "Install Java and ssh without password."}''
'
Metadata:
ALIYUN::ROS::Designer:
id: e35badb8-f0f8-4547-95a7-2baf1ee2b0cf
Master:
Type: ALIYUN::ECS::Instance
Properties:
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Ref: SecurityGroup
ImageId:
Ref: ImageId
InstanceName:
Ref: InstanceName
InstanceType:
Ref: InstanceType
IoOptimized: optimized
Password:
Ref: InstancePassword
SystemDiskCategory:
Ref: SystemDiskCategory
UserData:
Fn::Replace:
- ros-notify:
Fn::GetAtt:
- MasterConditionHandle
- CurlCli
- Fn::Join:
- ''
- - "#!/bin/bash \n"
- ipaddr_slave1=
- Fn::GetAtt:
- Slave1
- PrivateIp
- '
'
- ipaddr_slave2=
- Fn::GetAtt:
- Slave2
- PrivateIp
- '
'
- "yum -y install java \n"
- "hostnamectl --static set-hostname 'master.hadoop' \n"
- "export HOME=/root \n"
- "export HOSTNAME=`hostname` \n"
- "ip_addr=`ifconfig eth0 | awk '/inet /{print $2}'` \n"
- " \n"
- "cd /root \n"
- "rm -rf .ssh \n"
- "ssh-keygen -t rsa -P '' -f '/root/.ssh/id_rsa' \n"
- "cd /root/.ssh \n"
- "mv id_rsa bak.id_rsa \n"
- "mv id_rsa.pub bak.id_rsa.pub \n"
- "echo '-----BEGIN RSA PRIVATE KEY-----' > id_rsa \n"
- "echo 'MIIEowIBAAKCAQEAzfQ/QHwWB1njU9+Wu3RYi9g+g5rydSpAE0klefTJuZjtcaic'\
\ >> id_rsa \n"
- "echo 'SCeBN5avih8UToZ148+Ef2YzOtoosqluZpoYLCPSpAqr8pmviBJIU3vfu9mnDG9L'\
\ >> id_rsa \n"
- "echo 'oevT6K8w3wCBRCmqu+vc0Tpju/EeCuYK3+8w7e2I6F3+zIYzhhX3qmkocje7ACnV'\
\ >> id_rsa \n"
- "echo 'yh2DB/2m3sogTMc0RT+5y3kJAnC6TOIlGsYjOOkPbEF3If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iTn'\
\ >> id_rsa \n"
- "echo 'VBZILkDf+WCwQ98P5UMoumI0goIcNZ+AXhcqrikCgYBkSwLvKfYfqH9Mvfv5Odsr'\
\ >> id_rsa \n"
- "echo '9NKUv1c20FB1BYYh/mxp6eIbTW/CbwXZup6IqCvoHxpBAlna77b3T6iibSDsTgtE'\
\ >> id_rsa \n"
- "echo 'kirw6Q8/mBukBrpWZGa4QeJ4nPBQuncuUmx4H/7Y6CaZkZW5DiMF8OIbEmYT0y7+'\
\ >> id_rsa \n"
- "echo 'zh222r9CLtFYH23aL/uSLwKBgQCS1xyG2eE41aw5RBznDWtJW15iA5If8sJD5ocu'\
\ >> id_rsa \n"
- "echo 'eWp2aImUQS8ghxdmEozI6U5WA7CmdWUyObFXTPc/Z6FLXwqJ5IZ+CRt0neuIFNSA'\
\ >> id_rsa \n"
- "echo 'EQy9iFQ1FBUW06BRQpBns7yOg9jr6BOTxchjIV0I9caDp1nKRIrWU9NQ9iCFnYVA'\
\ >> id_rsa \n"
- "echo '7IsvQQKBgFxgF7UOhwaiMb/ATSuhm2v9kVvRPEO9umdo7YJ9I4L09lYbAtpcnusQ'\
\ >> id_rsa \n"
- "echo 'fIROYL25VeEMgYcQyInc3Fm/sgJdbXQnUy+3QbbCcBCmcLj27LPQyxuu7p9hbPPT'\
\ >> id_rsa \n"
- "echo 'Mxx37OmYvOkSVTQz0T9HfDGvOJgt4t4cXD4T/7ewk62p6jdpSQrt' >> id_rsa\
\ \n"
- "echo '-----END RSA PRIVATE KEY-----' >> id_rsa \n"
- "echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDN9D9AfBYHWeNT35a7dFiL2D6DmvJ1KkATSSV59Mm5mO1xqJxIJ4E3lq+KHxROhnXjz4R/ZjM62iiyqW5mmhgsI9KkCqvyma+IEkhTe9+72acMb0uh69PorzDfAIFEKaq769zROmO78R4K5grf7zDt7YjoXf7MhjOGFfeqaShyN7sAKdXKHYMH/abeyiBMxzRFP7nLeQkCcLpM4iUaxiM46Q9sQXch+fWjhmM4U6ZCVxEl6vjUTqtN1cDFLa4M0wUEJ/1fLHs70n4QtMIBdziHsATpYt1BvkCnO/i3UqzAIC1F6c/XEZxRhjwj8lRPZW8Fa1Al6eeuT2Os9lQUNyZz\
\ root@iZ2zee53wf4ndvajz30cdvZ' > id_rsa.pub \n"
- "cp id_rsa.pub authorized_keys \n"
- "chmod 600 authorized_keys \n"
- "chmod 600 id_rsa \n"
- "sed -i 's/# StrictHostKeyChecking ask/StrictHostKeyChecking no/'\
\ /etc/ssh/ssh_config \n"
- "sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/' /etc/ssh/ssh_config\
\ \n"
- "service sshd restart \n"
- "scp -r /root/.ssh/bak.* root@$ipaddr_slave1:/root/.ssh/ \n"
- "scp -r /root/.ssh/bak.* root@$ipaddr_slave2:/root/.ssh/ \n"
- "ssh root@$ipaddr_slave1 \"cd /root/.ssh; rm -f id_rsa; mv bak.id_rsa\
\ id_rsa; rm -f id_rsa.pub; mv bak.id_rsa.pub id_rsa.pub; rm -f authorized_keys;\
\ cp id_rsa.pub authorized_keys; chmod 600 authorized_keys; chmod 600\
\ id_rsa; exit\" \n"
- "ssh root@$ipaddr_slave2 \"cd /root/.ssh; rm id_rsa; mv bak.id_rsa id_rsa;\
\ rm id_rsa.pub; mv bak.id_rsa.pub id_rsa.pub; rm authorized_keys; cp\
\ id_rsa.pub authorized_keys; chmod 600 authorized_keys; chmod 600 id_rsa;\
\ exit\" \n"
- "cd /root/.ssh \n rm id_rsa \n mv bak.id_rsa id_rsa \n rm id_rsa.pub\
\ \n mv bak.id_rsa.pub id_rsa.pub \n rm authorized_keys \n cp id_rsa.pub\
\ authorized_keys \n chmod 600 authorized_keys \n chmod 600 id_rsa \n\
\ cd \n"
- " \n"
- "echo $ip_addr master.hadoop >> /etc/hosts \n"
- "echo $ipaddr_slave1 slave1.hadoop >> /etc/hosts \n"
- "echo $ipaddr_slave2 slave2.hadoop >> /etc/hosts \n"
- "ssh root@$ipaddr_slave1 \"echo $ip_addr master.hadoop >> /etc/hosts;\
\ exit\" \n"
- "ssh root@$ipaddr_slave1 \"echo $ipaddr_slave1 slave1.hadoop >> /etc/hosts;\
\ exit\" \n"
- "ssh root@$ipaddr_slave1 \"echo $ipaddr_slave2 slave2.hadoop >> /etc/hosts;\
\ exit\" \n"
- "ssh root@$ipaddr_slave2 \"echo $ip_addr master.hadoop >> /etc/hosts;\
\ exit\" \n"
- "ssh root@$ipaddr_slave2 \"echo $ipaddr_slave1 slave1.hadoop >> /etc/hosts;\
\ exit\" \n"
- "ssh root@$ipaddr_slave2 \"echo $ipaddr_slave2 slave2.hadoop >> /etc/hosts;\
\ exit\" \n"
- 'ros-notify -d ''{"data" : "Install Java and ssh without password."}''
'
DependsOn:
- Slave1
- Slave2
Metadata:
ALIYUN::ROS::Designer:
id: e4243623-1626-4704-a20c-1945e2d0394e
MasterConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
Properties: {}
Metadata:
ALIYUN::ROS::Designer:
id: dd73c34c-a8f9-4e31-be29-fa765d5cea96
MasterWaitCondition:
Type: ALIYUN::ROS::WaitCondition
Properties:
Count: 1
Handle:
Ref: MasterConditionHandle
Timeout: 7200
DependsOn: Master
Metadata:
ALIYUN::ROS::Designer:
id: 624e00d7-715c-45fd-881a-b036b78e5970
Slave1ConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
Properties: {}
Metadata:
ALIYUN::ROS::Designer:
id: 8bd4959c-fcbc-4216-923e-5a731e909ff4
Slave1WaitCondition:
Type: ALIYUN::ROS::WaitCondition
Properties:
Count: 1
Handle:
Ref: Slave1ConditionHandle
Timeout: 7200
DependsOn: Slave1
Metadata:
ALIYUN::ROS::Designer:
id: f3f86e4f-2f78-49d8-9520-a045893aa0e4
Slave2ConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
Properties: {}
Metadata:
ALIYUN::ROS::Designer:
id: bc848715-5cf4-44f6-92eb-9072b650d0d9
Slave2WaitCondition:
Type: ALIYUN::ROS::WaitCondition
Properties:
Count: 1
Handle:
Ref: Slave2ConditionHandle
Timeout: 7200
DependsOn: Slave2
Metadata:
ALIYUN::ROS::Designer:
id: f2063785-1593-445f-b8b0-a66f8652519a
Outputs:
Master Public IP:
Description: Master public IP.
Value:
Fn::GetAtt:
- Master
- PublicIp
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VpcCidrBlock
- VSwitchCidrBlock
Label:
default: VPC
- Parameters:
- ZoneId
- InstanceName
- ImageId
- InstanceType
- SystemDiskCategory
- InstancePassword
Label:
default: ECS
TemplateTags:
- acs:example:网站:创建3个ECS并安装配置JDK,域名解析并配置无密码ssh登录环
ALIYUN::ROS::Designer:
2bce8ba6-7065-4c49-bd72-e91bfbf27afa:
source:
id: f2063785-1593-445f-b8b0-a66f8652519a
target:
id: bc848715-5cf4-44f6-92eb-9072b650d0d9
z: 1
402891da-53f3-4429-9165-bd54448fc01b:
source:
id: e35badb8-f0f8-4547-95a7-2baf1ee2b0cf
target:
id: a7de7dea-6e2d-4d70-a27f-bb0db4417aa3
z: 1
624e00d7-715c-45fd-881a-b036b78e5970:
position:
x: 99
y: 164
size:
height: 60
width: 60
z: 0
69a6921f-61c6-4c0b-b7ba-3720944aa166:
source:
id: 87df6ea5-8234-4e02-b093-bfe111d85772
target:
id: a7de7dea-6e2d-4d70-a27f-bb0db4417aa3
z: 1
741f1552-fae5-48d1-8dc4-9bed0785644c:
embeds:
- f809586c-bea7-4e43-8114-239bdd811004
- a7de7dea-6e2d-4d70-a27f-bb0db4417aa3
position:
x: 215
y: 123
size:
height: 399
width: 414
z: 0
87df6ea5-8234-4e02-b093-bfe111d85772:
position:
x: 388
y: 195
size:
height: 60
width: 60
z: 2
8abe42cb-fe88-4b8a-a560-394ad396a699:
source:
id: e4243623-1626-4704-a20c-1945e2d0394e
target:
id: a7de7dea-6e2d-4d70-a27f-bb0db4417aa3
z: 1
8bd4959c-fcbc-4216-923e-5a731e909ff4:
position:
x: 532
y: 37
size:
height: 60
width: 60
z: 0
a7de7dea-6e2d-4d70-a27f-bb0db4417aa3:
position:
x: 388
y: 432
size:
height: 60
width: 60
z: 1
bc848715-5cf4-44f6-92eb-9072b650d0d9:
position:
x: 675
y: 415
size:
height: 60
width: 60
z: 0
dd73c34c-a8f9-4e31-be29-fa765d5cea96:
position:
x: 99
y: 418
size:
height: 60
width: 60
z: 0
e35badb8-f0f8-4547-95a7-2baf1ee2b0cf:
position:
x: 482
y: 247
size:
height: 60
width: 60
z: 2
e3ca2ccf-5f06-47c1-be85-11f75ae16fcd:
source:
id: f3f86e4f-2f78-49d8-9520-a045893aa0e4
target:
id: 8bd4959c-fcbc-4216-923e-5a731e909ff4
z: 1
e4243623-1626-4704-a20c-1945e2d0394e:
position:
x: 299
y: 247
size:
height: 60
width: 60
z: 2
e77b90c2-6d1d-4d12-a1f3-56d6382c42ed:
source:
id: 624e00d7-715c-45fd-881a-b036b78e5970
target:
id: dd73c34c-a8f9-4e31-be29-fa765d5cea96
z: 1
f2063785-1593-445f-b8b0-a66f8652519a:
position:
x: 675
y: 157
size:
height: 60
width: 60
z: 0
f3f86e4f-2f78-49d8-9520-a045893aa0e4:
position:
x: 299
y: 37
size:
height: 60
width: 60
z: 0
f809586c-bea7-4e43-8114-239bdd811004:
embeds:
- 87df6ea5-8234-4e02-b093-bfe111d85772
- e35badb8-f0f8-4547-95a7-2baf1ee2b0cf
- e4243623-1626-4704-a20c-1945e2d0394e
position:
x: 261
y: 157
size:
height: 248
width: 333
z: 1