-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.sh
More file actions
executable file
·579 lines (464 loc) · 31.1 KB
/
script.sh
File metadata and controls
executable file
·579 lines (464 loc) · 31.1 KB
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
# Run Ansible Playbook
function runAnsiblePlaybook(){
ansible-playbook playbook.yml -i hosts.ini
}
# Complete
function bishBashBosh(){
hub_ip=$(cat hub.txt | cut -d- -f1)
clear
cat <<-"PIPBOY"
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓██▓▓▓▓▓▓█▒░░░▒▒▒░░░░░░▒▒▒▒▒▒▒░▓█▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓█▒▒█▓▓▓▓██░░░░░░░░░░░░░░▒▒▒▒▒▒▒▒▒▓█▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓█▓░░░▒████▒░░░░░░░░░░░▒▒▒░▒▒▒▒▒▒▒▒▒░▒██▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓█▒░░░░░░░░░░░▓▓▒▒▒▓▓░░░░░▓▒▒▒▒▒▒▒▒▒▒▒▒░▒█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒
▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓█▓░░░░░░░░░▓▒░░░░░░░░░░░░░▒▓▒▒▓▓▒▒▓▓▒▒▒▒▒█▓▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▓▓▒░░░░▒▓▒░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▒▒▒░▓▓▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓░▒▒▓█▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒█▒▒▒▒▒█▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▓▒░░▓▒░░▓▓░░░░░░░░░░░░░░▒▓█░░░░░░░░░▒▓▒▒▒▒▒▒▓▓▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓▓▒░░░░░░░░░░░░░░░░░░░░░░▓▒░░░░░░▒▓▒▒▒▒▒▒▒▒█▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒░▒▓▒▒▒▒▒▓▓▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▓█░░░░▒██░░░░░▒▓░░░░░▓███▒░░░░░░░░░▒█▓▓▒▒▒▒█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒█▒░░░░▒██░░░░▓▓░░░░░░░░░░▓░░░░░░░░░▓▒▒▓▓▒▒▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▓▓▓▓▓▓▓▒▒▒▒▒▒▒▓███▓██▓▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▓█░░░░░░░░░░░▒▓░░░░░░░░░░░░░░░░░░░░▒▒▒▓▒▓▒▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▓▓▓▓▓▓▓▓▓▓▓▓▓█▓░░░░░░█▓▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▓█░░░░░░░░░▒█▓░░░░░░░░░░░░░░░░░░░░▒▓▒▒▒░▒██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓
▓▓▓▓▓▓▓▓▓▓▓▓█▓░░░░░░░█▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▒▓█░░░░░░░░░░░▓░░░░░░░░░░░░░░░░░░░░░░▒░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓
▓▓▓▓▓▓▓▓▓▓▓▓█▒░░░░░░██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓█░░░░░░░░░░░░░░░░░░░░▓░░░░░░░░░░░░░░░░░░█▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓▓▓▓▓▓██▒░░░░░░█▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓█░░░░▓░░░░░░░░░░░░░░▓███▒░░░░░░░░░░░░░░░▒█▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓▓▓▓▓▓▓█▓░░░░░░█▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒░▒░▒▓▓▓▓▓▓▓▓█▓░░▒▓░░░░▒▒▒▒▒▒▒░░░░░▒██░░░░░░░░░░░░░░░█▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓▓▓▓▓▓▓██▓░░░░░▒█▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒░░░░▒▒▓▓▓▓▓██▒░░▒▒▓▓▒░░░░░░░░▒▓▓▒░░▒░░░░░░░░░░▒▒▒██▓▓▒▒▒▒░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓▓▓████████▓▒▒░░▒▓██▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒░░░░░░▒▒▒▓▓▓██░░░░░░░▒▒▒▒▓▓▒░░░░░░░░░░░░░░░░░▓█▓▓▓▓▒░░░░░▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓█▒▒░░░░░░░░░░░▒█▓░░▒▒█▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒░░░░░░░░░▒▒▓▓▓█▓░░░░░░░▒▓▒░░░░░░░░░░░░░░░░░▒█▓▓▒▒░░░░░░░░░░░▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓█░░░░░░░░░░░░░░░▒█▒░░▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒░░░░░░░░▒▓▓██░░░░░░░░░░░░░░░░░░░░░░░░▒██▓▓▒░░░░░░░░░▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓█▒░░░░░░░░░░░░░░░█▒░░▒▓█████▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒░▒▒▒▒▒▒▓███▒░░░░░░░░░░░░░░░░░░░▓▓█▓░░░░▒▓▓▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓█████▓▓▓▓▓▓▓▒▒▓▓░░░░▒▓▓▓█▒▒▒▒▓▓▓▓███████████████▓▓▓▓▓▓█▒▒▓██▓▒▒░░░░░░░░░░░░░▓▓░░░░░░░█▓▓██▓▓▓▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▒▒▒▒▒▓▓░░░░░░░░░░░░░▓█▓░░░▒█▓▒▓█▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█░░░░▒██▒░░░░░░░░░░▒██▒░░░░░░░▒█▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▒▒▒▒▓▓▒░░░░░░░░░░░░░░░▓▓░░█▓▒▒▒█▓▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█░░░░░░░▒▓████████▓░░░░░░░░░░▒█▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▓▓█▒░░░░░░░░░░░░░░▓▓░▒▒█▓▒▒▓█▓▓▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▒░░░░░░░░░░░░░░░░░░░░░░░░░░▒█▓▓▓▓▓▓▓▓▓▓▓▓▓█▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▓██▓▓▒▒▒▒▒▓▓███▓▒░░░▒█▓▒▒▓█▓▓▓▓▓▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▓█▒░░░░░░░░░░░░▓▒░░░▓█▒▒▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▒░░░░░░░░░░░░░░░▒▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▓▓█▒░░░░░░░░░░░█▒░░▒▓▒▒▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▓▓▓▓▓▓▓▓▓▓▓▓█▒░░░░░░░░░▒███▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▓▓▓██▓▓█████▓▒▒▓█▓▒▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█████▓▓▓▓▓▓▓▓▓▓▓█▓░░░░░░░░░░█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▓▓▓▓▓▓▓▓▓██████████▓███▓▓▓▓▓▓▓▓▓▓▓▓▓▓██████▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓█▒░░░░░░░░░░█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓███████▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓█▒░░░░░░░░░▒█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▓▒▒▒▒▓█▓▓▓▓▓▓▓▓▓▓▓█░░░░░░░░░░▒█▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒░░░▒▒▓█▓▓▓▓▓▓▓▓▓▓▓█░░░░░░░░░░▒█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒░░░░░░░▒▒▓█▓▓▓▓▓▓▓▓▓▓▓█░░░░░░░░░░░█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒░░░░░░░░░░▒▓██▓▒▓▓▓▓▓▓▓▓▓█▒░░░░░░░░░░█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▒▓▓████▓▓▓▓▓▓▓▒▓▒▓▓▓▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒░░░░░▒▒▓▓▓▓█▓▒▓▓▓▓▓▓▓▓▓█▒░░░░░░░░░░█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▒▒▒▒▓██▓▓▓▓▓▓▒▒▓▓▓▓▓▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
PIPBOY
echo ""
echo ""
echo ""
echo "Bish, Bash, Bosh...job's a gud'"
echo "Grid console can be found here: ==== http://"$hub_ip":4444/grid/console ===="
echo ""
echo "Direct your tests here: ==== http://"$hub_ip":4444/wd/hub ===="
}
function runTest(){
function createTestEnv(){
rm -rf test_the_grid
mkdir test_the_grid && cd $_
npm init -y
npm install --save selenium-webdriver
}
function createTest(){
hub_ip=$(cat ../hub.txt | cut -d- -f1)
cat > sample_test.js <<-DOIT
const {Builder, By, Key, until} = require('selenium-webdriver');
const fs = require('fs');
const hubIP = 'http://$hub_ip:4444/wd/hub';
console.log("=======================================================================================================================");
console.log(" This is a small sample test, designed to prove that Selenium Grid is up and running.");
console.log("=======================================================================================================================");
console.log("");
console.log("+ There is only one test - go to google.com, input a search query, get page title on results page");
console.log("+ The test is performed on both FIREFOX and CHROME using Xvfb (not headlessly) so there should be an output from both");
console.log("+ For further proof the test has been run, a screenshot is captured and saved to the folder from where the test was ran");
console.log("");
(async function exampleChrome() {
let driver = await new Builder().forBrowser('chrome').usingServer(hubIP).build();
try {
await driver.get('https://www.google.com/');
await driver.wait(until.elementLocated(By.name('q')));
await driver.findElement(By.name('q')).sendKeys('thumbs up pip boy', Key.RETURN);
await driver.wait(until.titleIs('thumbs up pip boy - Google Search'), 1000);
console.log('CHROME PROOF OF LIFE ----- The page title is: ', await driver.getTitle(), '(type> open chrome.png)\n\n');
await driver.takeScreenshot().then(function(data){
var base64Data = data.replace(/^data:image\/png;base64,/,"")
fs.writeFile("chrome.png", base64Data, 'base64', function(err) {
if(err) console.log(err);
});
});
} finally {
await driver.quit();
}
})();
(async function exampleFirefox() {
let driver = await new Builder().forBrowser('firefox').usingServer(hubIP).build();
try {
await driver.get('https://www.google.com/');
await driver.wait(until.elementLocated(By.name('q')));
await driver.findElement(By.name('q')).sendKeys('thumbs up', Key.RETURN);
await driver.wait(until.titleIs('thumbs up - Google Search'), 1000);
console.log('FIREFOX PROOF OF LIFE ---- The page title is: ', await driver.getTitle(), '(type> open firefox.png)\n\n');
await driver.takeScreenshot().then(function(data){
var base64Data = data.replace(/^data:image\/png;base64,/,"")
fs.writeFile("firefox.png", base64Data, 'base64', function(err) {
if(err) console.log(err);
});
});
} finally {
await driver.quit();
}
})();
DOIT
}
createTestEnv
createTest
clear
node ./test_the_grid/sample_test.js
cd ..
echo ""
echo ""
echo ""
echo ""
}
# Remove all traces of previous build from working directory
function resetFolder(){
set +e
rm -f hosts.ini
rm -f hub.txt
rm -f nodes.txt
rm -f playbook.yml
rm -f playbook.retry
rm -f encrypted_bertha.pem
rm -f encrypted_bertha.pem.pub
rm -f pingOutput.txt
rm -f chrome-install.sh
rm -f chrome-install.sh-n
rm -f share-libraries.sh
rm -f post-chrome-install.sh
rm -f create-node-config.sh
rm -f firefox-install.sh
rm -f seleniumHub.sh
rm -rf test_the_grid
rm -rf .terraform
set -e
}
# Remove previous build's temporary files from working directory
function postInstallCleanUp(){
set +e
rm -f pingOutput.txt
rm -f chrome-install.sh
rm -f chrome-install.sh-n
rm -f share-libraries.sh
rm -f post-chrome-install.sh
rm -f create-node-config.sh
rm -f firefox-install.sh
rm -f seleniumHub.sh
set -e
}
#Creates new key pair
function createKey(){
ssh-keygen -t rsa -C "encrypted_bertha" -f encrypted_bertha.pem -N ''
}
# Initializes and runs Terraform script
function runTerraformApply(){
clear
echo "How many nodes do you require?"
read nodesRequired
echo ""
echo ""
echo ""
echo "Initializing and running Terraform..."
terraform init
terraform apply -auto-approve -var no_of_nodes="$nodesRequired" -var access_key="$AWS_ACCESS_KEY_ID" -var secret_key="$AWS_SECRET_ACCESS_KEY"
hub_public_ip=$(cat hub.txt | cut -d- -f1)
hub_private_ip=$(cat hub.txt | cut -d- -f2)
node_count=$(grep -c "[^ \\n\\t]" nodes.txt)
}
# Terraform Destroy and removal of keys
function runTerraformDestroy(){
if [ -f ./nodes.txt ]
then
nodes=$(grep -c "[^ \\n\\t]" nodes.txt)
else
echo "nodes.txt isn't there. If you know there are N nodes to delete then create a nodes.txt file with N number of lines containing a few random letters per line and run this script again."
exit 1
fi
terraform destroy -var no_of_nodes="$nodes"
rm -f terraform.tfstate
rm -f terraform.tfstate.backup
}
# Creates Ansible hosts file from Terraform output
function createAnsibleHosts(){
echo "[all:vars]" > hosts.ini
echo "ansible_ssh_private_key_file=./encrypted_bertha.pem" >> hosts.ini
echo "ansible_user=ec2-user" >> hosts.ini
echo "ansible_ssh_extra_args='-o StrictHostKeyChecking=no'" >> hosts.ini
echo "" >> hosts.ini
echo "[hub]" >> hosts.ini
echo "$(cat hub.txt | cut -d- -f1)" >> hosts.ini
for ((a=1; a <= $node_count ; a++))
do
echo "" >> hosts.ini
echo "[node"$a"]" >> hosts.ini
echo "$(cat nodes.txt | cut -d- -f1| sed -n "$a"p)" >> hosts.ini
done
echo "Ansible hosts file created\n\n"
}
# Ping IP addresses in hosts.ini file
function ansiblePing(){
clear
echo "PING-ing all IP address in Ansible hosts file\n\n"
ping_success () {
ansible all -m ping -i hosts.ini > pingOutput.txt
if grep -Fq "UNREACHABLE" pingOutput.txt
then
return 1
else
return 0
fi
}
set +e
counter=1
limit=300
while [ $counter -le $limit ]
do
ping_success
if [ $? = 0 ]
then
echo "All IP's pinged successfully\n\n"
rm -f pingOutput.txt
break
else
clear
echo "Waiting for EC2s to spin-up...\n"
fi
((counter++))
echo "This may take a few minutes. Use ctr+c to exit"
done
set -e
if [ $counter == $(let limit++) ]
then
clear
echo "There was a problem pinging the IP's in your Ansible hosts file. Here is the output:\n\n"
cat pingOutput.txt
rm -f ./pingOutput.txt
exit 1
fi
}
# Construct Firefox installation script
function constructFirefoxScript(){
echo "# Install Xvfb" > firefox-install.sh
echo "sudo yum -y install xorg-x11-server-Xvfb xorg-x11-fonts" >> firefox-install.sh
echo "" >> firefox-install.sh
echo "# Install firefox" >> firefox-install.sh
echo 'sudo wget -O firefox.tar.bz2 "https://download.mozilla.org/?product=firefox-esr-latest-ssl&os=linux64&lang=en-GB"' >> firefox-install.sh
echo "sudo bzcat firefox.tar.bz2 | tar xvf -" >> firefox-install.sh
echo "" >> firefox-install.sh
echo "# Install firfox dependancy not included in chrome" >> firefox-install.sh
echo 'sudo yum -y install dbus-glib.x86_64' >> firefox-install.sh
echo "" >> firefox-install.sh
echo "# Make Firefox accessible from anywhere in the system" >> firefox-install.sh
echo "cd /usr/local" >> firefox-install.sh
echo "sudo ln -s ~/firefox/firefox /usr/bin/firefox" >> firefox-install.sh
echo "" >> firefox-install.sh
echo "# Install Geckodriver" >> firefox-install.sh
echo "cd ~/" >> firefox-install.sh
echo "wget https://github.com/mozilla/geckodriver/releases/download/v0.23.0/geckodriver-v0.23.0-linux64.tar.gz" >> firefox-install.sh
echo "tar -xvf geckodriver-v0.23.0-linux64.tar.gz" >> firefox-install.sh
echo "sudo mv geckodriver /usr/bin/" >> firefox-install.sh
echo "" >> firefox-install.sh
echo "# Leave a mark" >> firefox-install.sh
echo "touch ~/1-Firefox-installed.txt" >> firefox-install.sh
}
# Construct Chrome installation script
function constructChromeScript(){
curl https://intoli.com/install-google-chrome.sh > chrome-install.sh
# Add in lines that will leave a mark once script runs successfully
sed -i -n '/Successfully/a\
pushd /home/ec2-user \
touch 2-Chrome-installed.txt \
pushd +1 \
' chrome-install.sh
}
# Construct Post-Chrome installation script
function constructPostChromeScript(){
echo "# Install Chromedriver" > post-chrome-install.sh
echo "wget https://chromedriver.storage.googleapis.com/2.45/chromedriver_linux64.zip" >> post-chrome-install.sh
echo "unzip chromedriver_linux64.zip" >> post-chrome-install.sh
echo "sudo mv chromedriver /usr/bin/chromedriver" >> post-chrome-install.sh
echo "" >> post-chrome-install.sh
echo "# Rename google-chrome-stable to google-chrome for easier identification by selenium" >> post-chrome-install.sh
echo "sudo mv /usr/bin/google-chrome-stable /usr/bin/google-chrome" >> post-chrome-install.sh
echo "" >> post-chrome-install.sh
echo "# Leave a mark" >> post-chrome-install.sh
echo "touch ~/3-Post-chrome-installed.txt" >> post-chrome-install.sh
}
# Make the required libraries for Firefox shared with this script
function constructShareLibrariesScript(){
echo "# " > share-libraries.sh
echo 'echo export LD_LIBRARY_PATH="/opt/google/chrome/lib:$LD_LIBRARY_PATH" >> /home/ec2-user/.bashrc' >> share-libraries.sh
echo 'source /home/ec2-user/.bashrc' >> share-libraries.sh
echo "touch ~/5-Libraries-shared.txt" >> share-libraries.sh
}
function constructSeleniumHubScript(){
echo '# download selenium standalone server if not there already' > seleniumHub.sh
echo 'cd /home/ec2-user' >> seleniumHub.sh
echo 'if [ ! -f selenium.jar ]' >> seleniumHub.sh
echo 'then' >> seleniumHub.sh
echo ' wget -O selenium.jar "http://selenium-release.storage.googleapis.com/3.9/selenium-server-standalone-3.9.1.jar"' >> seleniumHub.sh
echo 'fi' >> seleniumHub.sh
echo '' >> seleniumHub.sh
echo '# install Java 8 if needed' >> seleniumHub.sh
echo 'sudo yum -y install java-1.8.0-openjdk-devel' >> seleniumHub.sh
echo '' >> seleniumHub.sh
echo '# run selenium' >> seleniumHub.sh
echo 'nohup java -jar selenium.jar -role hub -host' $(cat hub.txt | cut -d- -f2) '> ~/nohup.out &' >> seleniumHub.sh
}
# Construct Node config.json file constructor!
function constructNodeConfigConstructorSript(){
hub_private_ip=$(cat hub.txt | cut -d- -f2)
cat > create-node-config.sh <<-EOL
# Construct Node json config file
echo '{' >> config.json
echo ' "capabilities":' >> config.json
echo ' [' >> config.json
echo ' {' >> config.json
echo ' "browserName": "firefox",' >> config.json
echo ' "marionette": true,' >> config.json
echo ' "maxInstances": 5,' >> config.json
echo ' "seleniumProtocol": "WebDriver"' >> config.json
echo ' },' >> config.json
echo ' {' >> config.json
echo ' "browserName": "chrome",' >> config.json
echo ' "maxInstances": 5,' >> config.json
echo ' "seleniumProtocol": "WebDriver"' >> config.json
echo ' }' >> config.json
echo ' ],' >> config.json
echo ' "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",' >> config.json
echo ' "maxSession": 5,' >> config.json
echo ' "port": 5555,' >> config.json
echo ' "register": true,' >> config.json
echo ' "registerCycle": 5000,' >> config.json
echo ' "hub": "http://'$hub_private_ip':4444",' >> config.json
echo ' "nodeStatusCheckTimeout": 5000,' >> config.json
echo ' "nodePolling": 5000,' >> config.json
echo ' "role": "node",' >> config.json
echo ' "unregisterIfStillDownAfter": 60000,' >> config.json
echo ' "downPollingLimit": 2,' >> config.json
echo ' "debug": false,' >> config.json
echo ' "servlets" : [],' >> config.json
echo ' "withoutServlets": [],' >> config.json
echo ' "custom": {}' >> config.json
echo '}' >> config.json
touch ~/4-Config-file-created.txt
EOL
}
# Construct Ansible Playbook
function constructAnsiblePlaybook(){
echo "---" > playbook.yml
echo "- hosts: hub" >> playbook.yml
echo " tasks:" >> playbook.yml
echo " - name: Run selenium server as 'HUB'" >> playbook.yml
echo " script: ./seleniumHub.sh" >> playbook.yml
echo "" >> playbook.yml
node_count=$(grep -c "[^ \\n\\t]" nodes.txt)
for ((i=1; i <= node_count ; i++))
do
echo "- hosts: node"$i >> playbook.yml
echo " tasks:" >> playbook.yml
echo "" >> playbook.yml
echo " - name: Run Firefox installation script" >> playbook.yml
echo " script: ./firefox-install.sh" >> playbook.yml
echo " args:" >> playbook.yml
echo " creates: ~/1-Firefox-installed.txt" >> playbook.yml
echo "" >> playbook.yml
echo " - name: Run Chrome installation script" >> playbook.yml
echo " script: ./chrome-install.sh" >> playbook.yml
echo " args:" >> playbook.yml
echo " creates: ~/2-Chrome-installed.txt" >> playbook.yml
echo "" >> playbook.yml
echo " - name: Run POST-Chrome installation script" >> playbook.yml
echo " script: ./post-chrome-install.sh" >> playbook.yml
echo " args:" >> playbook.yml
echo " creates: ~/3-Post-chrome-installed.txt" >> playbook.yml
echo "" >> playbook.yml
echo " - name: Run Node config creation script" >> playbook.yml
echo " script: ./create-node-config.sh" >> playbook.yml
echo " args:" >> playbook.yml
echo " creates: ~/4-Config-file-created.txt" >> playbook.yml
echo "" >> playbook.yml
echo " - name: Copy Chrome libraries to shared location so Firefox can use them too" >> playbook.yml
echo " script: ./share-libraries.sh" >> playbook.yml
echo " args:" >> playbook.yml
echo " creates: ~/5-Libraries-shared.txt" >> playbook.yml
echo "" >> playbook.yml
echo " - name: Run selenium server as 'NODE'" >> playbook.yml
echo " shell: |" >> playbook.yml
echo " cd /home/ec2-user" >> playbook.yml
echo ' while [ ! -f selenium.jar ]; do wget -O selenium.jar "http://selenium-release.storage.googleapis.com/3.9/selenium-server-standalone-3.9.1.jar"; done' >> playbook.yml
echo " sudo yum -y install java-1.8.0-openjdk-devel" >> playbook.yml
echo " nohup xvfb-run --server-args='-screen 0 1400x1024x24' java -jar selenium.jar -role node -host" $(cat nodes.txt | cut -d- -f2 | sed -n "$i"p) "-nodeConfig config.json >> ~/nohup.out &" >> playbook.yml
echo "" >> playbook.yml
done
}
# create all scripts and files
function createAllScripts(){
constructFirefoxScript
constructChromeScript
constructPostChromeScript
constructShareLibrariesScript
constructNodeConfigConstructorSript
constructSeleniumHubScript
constructAnsiblePlaybook
}
# Menu selection
function menu(){
clear
while [ true ]
do
echo "Do you want to (c)reate, (d)estroy, run (p)laybook, run (t)est, (q)uit?"
read question
if [ $question == 'c' ]
then
resetFolder
createKey
runTerraformApply
createAnsibleHosts
ansiblePing
createAllScripts
runAnsiblePlaybook
postInstallCleanUp
bishBashBosh
elif [ $question == 'd' ]
then
runTerraformDestroy
resetFolder
elif [ $question == 'p' ]
then
createAllScripts
runAnsiblePlaybook
postInstallCleanUp
bishBashBosh
elif [ $question == 't' ]
then
runTest
elif [ $question == 'q' ]
then
clear
exit 0
fi
done
}
# Exit on error
set -e
# Give some sort of feedback if error forces exit
if [ $? == 1 ]
then
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT
fi
# Run menu
menu