forked from usui-tk/amazon-ec2-userdata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3rd-Bootstrap_SLES-v15-HVM.sh
1242 lines (999 loc) · 48.5 KB
/
3rd-Bootstrap_SLES-v15-HVM.sh
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
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash -v
set -e -x
# Logger
exec > >(tee /var/log/user-data_3rd-bootstrap.log || logger -t user-data -s 2> /dev/console) 2>&1
#-------------------------------------------------------------------------------
# Set UserData Parameter
#-------------------------------------------------------------------------------
if [ -f /tmp/userdata-parameter ]; then
source /tmp/userdata-parameter
fi
if [[ -z "${Language}" || -z "${Timezone}" || -z "${VpcNetwork}" ]]; then
# Default Language
Language="en_US.UTF-8"
# Default Timezone
Timezone="Asia/Tokyo"
# Default VPC Network
VpcNetwork="IPv4"
fi
# echo
echo $Language
echo $Timezone
echo $VpcNetwork
#-------------------------------------------------------------------------------
# Parameter Settings
#-------------------------------------------------------------------------------
# Parameter Settings
CWAgentConfig="https://raw.githubusercontent.com/usui-tk/amazon-ec2-userdata/master/Config_AmazonCloudWatchAgent/AmazonCloudWatchAgent_SLES-v15-HVM.json"
#-------------------------------------------------------------------------------
# Acquire unique information of Linux distribution
# - SUSE Linux Enterprise Server 15
# https://www.suse.com/documentation/sles-15/
# https://www.suse.com/ja-jp/documentation/sles-15/
# https://www.suse.com/documentation/suse-best-practices/
# https://forums.suse.com/forumdisplay.php?94-Amazon-EC2
#
# https://scc.suse.com/packages/?name=SUSE%20Linux%20Enterprise%20Server&version=15.1&arch=x86_64&query=&module=
#
# https://susepubliccloudinfo.suse.com/v1/amazon/images/active.json
# https://susepubliccloudinfo.suse.com/v1/amazon/images/active.xml
#
# https://aws.amazon.com/jp/partners/suse/faqs/
# https://aws.amazon.com/marketplace/pp/B07SPX8ML1
# http://d36cz9buwru1tt.cloudfront.net/SUSE_Linux_Enterprise_Server_on_Amazon_EC2_White_Paper.pdf
#
# https://en.opensuse.org/YaST_Software_Management
#
# https://github.com/SUSE-Enceladus
#-------------------------------------------------------------------------------
# Cleanup repository information
zypper clean --all
# Show Linux Distribution/Distro information
if [ $(command -v lsb_release) ]; then
lsb_release -a
fi
# Show Linux System Information
uname -a
# Show Linux distribution release Information
cat /etc/os-release
# Default installation package [rpm command]
rpm -qa --qf="%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" | sort > /tmp/command-log_rpm_installed-package.txt
# Default installation package [zypper command]
zypper search --installed-only > /tmp/command-log_zypper_installed-package.txt
# Default repository products list [zypper command]
zypper products > /tmp/command-log_zypper_repository-products-list.txt
# Default repository patterns list [zypper command]
zypper patterns > /tmp/command-log_zypper_repository-patterns-list.txt
# Default repository packages list [zypper command]
zypper packages > /tmp/command-log_zypper_repository-packages-list.txt
# systemd unit files
systemctl list-unit-files --all --no-pager > /tmp/command-log_systemctl_list-unit-files.txt
# systemd service config
systemctl list-units --type=service --all --no-pager > /tmp/command-log_systemctl_list-service-config.txt
# Determine the OS release
eval $(grep ^VERSION_ID= /etc/os-release)
#-------------------------------------------------------------------------------
# Default Package Update
#-------------------------------------------------------------------------------
# SUSE Linux Enterprise Server Software repository metadata Clean up
zypper clean --all
zypper --quiet refresh -fdb
# SUSE Linux Enterprise Server Software repository information
zypper repos
# Package Configure SLES Modules
# https://www.suse.com/products/server/features/modules/
SUSEConnect --list-extensions
# Update default package
zypper --quiet --non-interactive update --auto-agree-with-licenses
# Apply SLES Service Pack
ZypperMigrationStatus="0"
if [ -n "$VERSION_ID" ]; then
if [ "${VERSION_ID}" = "15.3" ]; then
echo "SUSE Linux Enterprise Server 15 SP3 -> SUSE Linux Enterprise Server 15 Lastest ServicePack"
cat /etc/os-release
zypper migration --quiet --non-interactive --migration "1" --auto-agree-with-licenses --recommends --details || ZypperMigrationStatus=$?
if [ $ZypperMigrationStatus -eq 0 ]; then
echo "Successful execution [Zypper Migration Command]"
eval $(grep ^VERSION_ID= /etc/os-release)
# Update motd (message of the day)
eval $(grep ^PRETTY_NAME= /etc/os-release)
sed -i '1d' /etc/motd
sed -i "1i $PRETTY_NAME" /etc/motd
else
echo "Failed to execute [Zypper Migration Command]"
fi
cat /etc/os-release
elif [ "${VERSION_ID}" = "15.2" ]; then
echo "SUSE Linux Enterprise Server 15 SP2 -> SUSE Linux Enterprise Server 15 Lastest ServicePack"
cat /etc/os-release
zypper migration --quiet --non-interactive --migration "1" --auto-agree-with-licenses --recommends --details || ZypperMigrationStatus=$?
if [ $ZypperMigrationStatus -eq 0 ]; then
echo "Successful execution [Zypper Migration Command]"
eval $(grep ^VERSION_ID= /etc/os-release)
# Update motd (message of the day)
eval $(grep ^PRETTY_NAME= /etc/os-release)
sed -i '1d' /etc/motd
sed -i "1i $PRETTY_NAME" /etc/motd
else
echo "Failed to execute [Zypper Migration Command]"
fi
cat /etc/os-release
elif [ "${VERSION_ID}" = "15.1" ]; then
echo "SUSE Linux Enterprise Server 15 SP1 -> SUSE Linux Enterprise Server 15 Lastest ServicePack"
cat /etc/os-release
zypper migration --quiet --non-interactive --migration "1" --auto-agree-with-licenses --recommends --details || ZypperMigrationStatus=$?
if [ $ZypperMigrationStatus -eq 0 ]; then
echo "Successful execution [Zypper Migration Command]"
eval $(grep ^VERSION_ID= /etc/os-release)
# Update motd (message of the day)
eval $(grep ^PRETTY_NAME= /etc/os-release)
sed -i '1d' /etc/motd
sed -i "1i $PRETTY_NAME" /etc/motd
else
echo "Failed to execute [Zypper Migration Command]"
fi
cat /etc/os-release
elif [ "${VERSION_ID}" = "15" ]; then
echo "SUSE Linux Enterprise Server 15 GA -> SUSE Linux Enterprise Server 15 Lastest ServicePack"
cat /etc/os-release
zypper migration --quiet --non-interactive --migration "1" --auto-agree-with-licenses --recommends --details || ZypperMigrationStatus=$?
if [ $ZypperMigrationStatus -eq 0 ]; then
echo "Successful execution [Zypper Migration Command]"
eval $(grep ^VERSION_ID= /etc/os-release)
# Update motd (message of the day)
eval $(grep ^PRETTY_NAME= /etc/os-release)
sed -i '1d' /etc/motd
sed -i "1i $PRETTY_NAME" /etc/motd
else
echo "Failed to execute [Zypper Migration Command]"
fi
cat /etc/os-release
else
echo "SUSE Linux Enterprise Server 15 (Unknown)"
fi
fi
# SUSE Linux Enterprise Server Software repository metadata Clean up
zypper clean --all
zypper --quiet refresh -fdb
# Install recommended packages
# zypper --quiet --non-interactive install-new-recommends
#-------------------------------------------------------------------------------
# Custom Package Installation (from SUSE Linux Enterprise Server Software repository)
# - Pattern : Basic
#-------------------------------------------------------------------------------
# Package Install SLES System Administration Tools (from SUSE Linux Enterprise Server Software repository - Select pattern)
zypper --quiet --non-interactive install --type pattern base
zypper --quiet --non-interactive install --type pattern yast2_basis
zypper --quiet --non-interactive install --type pattern apparmor
zypper --quiet --non-interactive install --type pattern enhanced_base
#-------------------------------------------------------------------------------
# Custom Package Installation (from SUSE Linux Enterprise Server Software repository)
# - Package : Individual package
#-------------------------------------------------------------------------------
# Package Install SLES System Administration Tools (from SUSE Linux Enterprise Server Software repository - Select package)
zypper --quiet --non-interactive install aaa_base aaa_base-extras arptables bash-completion bc bcc-tools bind-utils blktrace cloud-netconfig-ec2 conntrack-tools curl dstat ebtables ethtool expect fio gdisk git-core gperftools hdparm hostinfo intltool iotop iotop kexec-tools kmod-bash-completion libicu lsb-release lvm2 lzop man-pages mcelog mdadm mlocate net-snmp nftables nmap numactl nvme-cli nvmetcli parted patchutils pmdk pmdk-tools psmisc rsync sdparm seccheck smartmontools strace supportutils supportutils-plugin-suse-public-cloud sysfsutils sysstat systemd-bash-completion tcpdump time traceroute tree tuned unrar unzip util-linux vim-enhanced wget xfsdump xfsprogs zip zypper-log
zypper --quiet --non-interactive install aws-efs-utils cifs-utils nfs-client nfs-utils nfs4-acl-tools yast2-nfs-client
zypper --quiet --non-interactive install libiscsi-utils libiscsi8 lsscsi open-iscsi sdparm sg3_utils yast2-iscsi-client
zypper --quiet --non-interactive install openscap openscap-content openscap-utils
if [ -n "$VERSION_ID" ]; then
if [ "${VERSION_ID}" = "15.3" ]; then
echo "SUSE Linux Enterprise Server 15 SP3"
zypper --quiet --non-interactive install jq purge-kernels-service
# [Workaround] Commented out from the fact that cloud-init processing is interrupted at the time of installation of pcp-related packages
# zypper --quiet --non-interactive install pcp pcp-conf pcp-system-tools
elif [ "${VERSION_ID}" = "15.2" ]; then
echo "SUSE Linux Enterprise Server 15 SP2"
zypper --quiet --non-interactive install jq purge-kernels-service
# [Workaround] Commented out from the fact that cloud-init processing is interrupted at the time of installation of pcp-related packages
# zypper --quiet --non-interactive install pcp pcp-conf pcp-system-tools
elif [ "${VERSION_ID}" = "15.1" ]; then
echo "SUSE Linux Enterprise Server 15 SP1"
zypper --quiet --non-interactive install jq
# [Workaround] Commented out from the fact that cloud-init processing is interrupted at the time of installation of pcp-related packages
# zypper --quiet --non-interactive install pcp pcp-conf pcp-system-tools
elif [ "${VERSION_ID}" = "15" ]; then
echo "SUSE Linux Enterprise Server 15 GA"
# [Workaround] Commented out from the fact that cloud-init processing is interrupted at the time of installation of pcp-related packages
# zypper --quiet --non-interactive install pcp pcp-conf
else
echo "SUSE Linux Enterprise Server 15 (Unknown)"
fi
fi
# Package Install Python 3 Runtime (from SUSE Linux Enterprise Server Software repository)
zypper --quiet --non-interactive install python3 python3-base python3-pip python3-setuptools python3-tools python3-virtualenv python3-wheel
zypper --quiet --non-interactive install python3-Babel python3-PyJWT python3-PyYAML python3-pycrypto python3-pycurl python3-cryptography python3-python-dateutil python3-requests-aws python3-simplejson python3-six python3-urllib3
# SUSE Linux Enterprise Server Software repository metadata Clean up
zypper clean --all
zypper --quiet refresh -fdb
#-------------------------------------------------------------------------------
# Custom Package Installation (from SUSE Linux Enterprise Server Software repository)
# - Pattern : Amazon Web Services
#-------------------------------------------------------------------------------
# Package Install SLES System AWS Tools (from SUSE Linux Enterprise Server Software repository)
SapFlag=0
SapFlag=$(find /etc/zypp/repos.d/ -name "*SLE-Product-SLES_SAP15*" | wc -l)
if [ -n "$VERSION_ID" ]; then
if [ "${VERSION_ID}" = "15.3" ]; then
echo "SUSE Linux Enterprise Server 15 SP3"
zypper --quiet --non-interactive install python3-susepubliccloudinfo
if [ $SapFlag -gt 0 ]; then
echo "SUSE Linux Enterprise Server for SAP Applications 15"
# zypper --quiet --non-interactive install --type pattern Amazon_Web_Services
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Init
# zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Tools
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Tools
else
echo "SUSE Linux Enterprise Server 15 (non SUSE Linux Enterprise Server for SAP Applications 15)"
# zypper --quiet --non-interactive install --type pattern Amazon_Web_Services
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Init
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Tools
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Tools
fi
elif [ "${VERSION_ID}" = "15.2" ]; then
echo "SUSE Linux Enterprise Server 15 SP2"
zypper --quiet --non-interactive install python3-susepubliccloudinfo
if [ $SapFlag -gt 0 ]; then
echo "SUSE Linux Enterprise Server for SAP Applications 15"
# zypper --quiet --non-interactive install --type pattern Amazon_Web_Services
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Init
# zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Tools
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Tools
else
echo "SUSE Linux Enterprise Server 15 (non SUSE Linux Enterprise Server for SAP Applications 15)"
# zypper --quiet --non-interactive install --type pattern Amazon_Web_Services
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Init
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Tools
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Tools
fi
elif [ "${VERSION_ID}" = "15.1" ]; then
echo "SUSE Linux Enterprise Server 15 SP1"
zypper --quiet --non-interactive install python3-susepubliccloudinfo
if [ $SapFlag -gt 0 ]; then
echo "SUSE Linux Enterprise Server for SAP Applications 15"
# zypper --quiet --non-interactive install --type pattern Amazon_Web_Services
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Init
# zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Tools
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Tools
else
echo "SUSE Linux Enterprise Server 15 (non SUSE Linux Enterprise Server for SAP Applications 15)"
# zypper --quiet --non-interactive install --type pattern Amazon_Web_Services
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Init
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Tools
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Tools
fi
elif [ "${VERSION_ID}" = "15" ]; then
echo "SUSE Linux Enterprise Server 15 GA"
if [ $SapFlag -gt 0 ]; then
echo "SUSE Linux Enterprise Server for SAP Applications 15"
# zypper --quiet --non-interactive install --type pattern Amazon_Web_Services
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Init
# zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Tools
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Tools
else
echo "SUSE Linux Enterprise Server 15 (non SUSE Linux Enterprise Server for SAP Applications 15)"
# zypper --quiet --non-interactive install --type pattern Amazon_Web_Services
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Init
# zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Tools
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Tools
fi
else
echo "SUSE Linux Enterprise Server 15 (Unknown)"
# zypper --quiet --non-interactive install --type pattern Amazon_Web_Services
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Init
# zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Instance_Tools
zypper --quiet --non-interactive install --type pattern Amazon_Web_Services_Tools
fi
fi
#-------------------------------------------------------------------------------
# Custom Package Installation (from SUSE Linux Enterprise Server Software repository)
# - Pattern : SAP
#-------------------------------------------------------------------------------
# Package Install SAP Utility and Tools (from SUSE Linux Enterprise Server Software repository
SapFlag=0
SapFlag=$(find /etc/zypp/repos.d/ -name "*SLE-Product-SLES_SAP15*" | wc -l)
if [ $SapFlag -gt 0 ]; then
echo "SUSE Linux Enterprise Server for SAP Applications 15"
# Package Install SAP Utility and Tools (from SUSE Linux Enterprise Server Software repository - Select pattern)
zypper --quiet --non-interactive install --type pattern sap_server
zypper --quiet --non-interactive install --type pattern sap-hana
# Package Install SAP Utility and Tools (from SUSE Linux Enterprise Server Software repository - Select package)
zypper --quiet --non-interactive install sapconf saptune insserv-compat
zypper --quiet --non-interactive install libz1-32bit libcurl4-32bit libX11-6-32bit libidn11-32bit libgcc_s1-32bit libopenssl1_0_0 glibc-32bit glibc-i18ndata glibc-locale-32bit
else
echo "SUSE Linux Enterprise Server 15 (non SUSE Linux Enterprise Server for SAP Applications 15)"
fi
#-------------------------------------------------------------------------------
# Default Package Update
#-------------------------------------------------------------------------------
# SUSE Linux Enterprise Server Software repository metadata Clean up
zypper clean --all
zypper --quiet refresh -fdb
# Update default package
zypper --quiet --non-interactive update --auto-agree-with-licenses
#-------------------------------------------------------------------------------
# Custom Package Installation (from SUSE Package Hub Repository)
# https://packagehub.suse.com/
# https://packagehub.suse.com/how-to-use/
#-------------------------------------------------------------------------------
# Package Install SLES System Administration Tools (from SUSE Package Hub Repository)
if [ -n "$VERSION_ID" ]; then
if [ "${VERSION_ID}" = "15.3" ]; then
echo "SUSE Linux Enterprise Server 15 SP3"
# Add SUSE Package Hub Repository : Version - SUSE Linux Enterprise 15 SP3
# SUSEConnect --status-text
# SUSEConnect --list-extensions
# SUSEConnect -p PackageHub/15.3/x86_64
# sleep 5
# Repository Configure SUSE Package Hub Repository
# SUSEConnect --status-text
# SUSEConnect --list-extensions
# zypper clean --all
# zypper --quiet refresh -fdb
# zypper repos
# Package Install SLES System Administration Tools (from SUSE Package Hub Repository)
# zypper --quiet --non-interactive install collectl mtr
elif [ "${VERSION_ID}" = "15.2" ]; then
echo "SUSE Linux Enterprise Server 15 SP2"
# Add SUSE Package Hub Repository : Version - SUSE Linux Enterprise 15 SP2
SUSEConnect --status-text
SUSEConnect --list-extensions
SUSEConnect -p PackageHub/15.2/x86_64
sleep 5
# Repository Configure SUSE Package Hub Repository
SUSEConnect --status-text
SUSEConnect --list-extensions
zypper clean --all
zypper --quiet refresh -fdb
zypper repos
# Package Install SLES System Administration Tools (from SUSE Package Hub Repository)
zypper --quiet --non-interactive install collectl mtr
elif [ "${VERSION_ID}" = "15.1" ]; then
echo "SUSE Linux Enterprise Server 15 SP1"
# Add SUSE Package Hub Repository : Version - SUSE Linux Enterprise 15 SP1
SUSEConnect --status-text
SUSEConnect --list-extensions
SUSEConnect -p PackageHub/15.1/x86_64
sleep 5
# Repository Configure SUSE Package Hub Repository
SUSEConnect --status-text
SUSEConnect --list-extensions
zypper clean --all
zypper --quiet refresh -fdb
zypper repos
# Package Install SLES System Administration Tools (from SUSE Package Hub Repository)
zypper --quiet --non-interactive install collectl mtr
elif [ "${VERSION_ID}" = "15" ]; then
echo "SUSE Linux Enterprise Server 15 GA"
# Add SUSE Package Hub Repository : Version - SUSE Linux Enterprise 15
SUSEConnect --status-text
SUSEConnect --list-extensions
SUSEConnect -p PackageHub/15/x86_64
sleep 5
# Repository Configure SUSE Package Hub Repository
SUSEConnect --status-text
SUSEConnect --list-extensions
zypper clean --all
zypper --quiet refresh -fdb
zypper repos
# Package Install SLES System Administration Tools (from SUSE Package Hub Repository)
zypper --quiet --non-interactive install collectl mtr
else
echo "SUSE Linux Enterprise Server 15 (Unknown)"
fi
fi
#-------------------------------------------------------------------------------
# Custom Package Installation (from openSUSE Build Service Repository)
# https://build.opensuse.org/
# https://download.opensuse.org/repositories/utilities/SLE_15/
#-------------------------------------------------------------------------------
# Package Install SLES System Administration Tools (from openSUSE Build Service Repository)
if [ -n "$VERSION_ID" ]; then
if [ "${VERSION_ID}" = "15.3" ]; then
echo "SUSE Linux Enterprise Server 15 SP3"
elif [ "${VERSION_ID}" = "15.2" ]; then
echo "SUSE Linux Enterprise Server 15 SP2"
elif [ "${VERSION_ID}" = "15.1" ]; then
echo "SUSE Linux Enterprise Server 15 SP1"
# Add openSUSE Build Service Repository [utilities/SLE_15_SP1_Backports]
zypper repos
zypper addrepo --check --refresh --name "SLE_15_SP1_Backports" "https://download.opensuse.org/repositories/utilities/SLE_15_SP1_Backports/utilities.repo"
zypper --gpg-auto-import-keys refresh utilities
# Repository Configure openSUSE Build Service Repository
zypper repos
zypper clean --all
zypper --quiet refresh -fdb
zypper repos
# Package Install SLES System Administration Tools (from openSUSE Build Service Repository)
zypper --quiet --non-interactive install atop
elif [ "${VERSION_ID}" = "15" ]; then
echo "SUSE Linux Enterprise Server 15 GA"
# Add openSUSE Build Service Repository [utilities/SLE_15]
zypper repos
zypper addrepo --check --refresh --name "SLE_15" "https://download.opensuse.org/repositories/utilities/SLE_15/utilities.repo"
zypper --gpg-auto-import-keys refresh utilities
# Repository Configure openSUSE Build Service Repository
zypper repos
zypper clean --all
zypper --quiet refresh -fdb
zypper repos
# Package Install SLES System Administration Tools (from openSUSE Build Service Repository)
zypper --quiet --non-interactive install atop
else
echo "SUSE Linux Enterprise Server 15 (Unknown)"
fi
fi
#-------------------------------------------------------------------------------
# Get AWS Instance MetaData Service (IMDS v1, v2)
# https://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html
# https://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
#-------------------------------------------------------------------------------
# Getting an Instance Metadata Service v2 (IMDS v2) token
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`
if [ -n "$TOKEN" ]; then
#-----------------------------------------------------------------------
# Retrieving Metadata Using the Instance Metadata Service v2 (IMDS v2)
#-----------------------------------------------------------------------
# Instance MetaData
Az=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s "http://169.254.169.254/latest/meta-data/placement/availability-zone")
AzId=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s "http://169.254.169.254/latest/meta-data/placement/availability-zone-id")
Region=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s "http://169.254.169.254/latest/meta-data/placement/region")
InstanceId=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s "http://169.254.169.254/latest/meta-data/instance-id")
InstanceType=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s "http://169.254.169.254/latest/meta-data/instance-type")
PrivateIp=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s "http://169.254.169.254/latest/meta-data/local-ipv4")
AmiId=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s "http://169.254.169.254/latest/meta-data/ami-id")
# IAM Role & STS Information
if [ $(compgen -ac | sort | uniq | grep -x jq) ]; then
RoleArn=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s "http://169.254.169.254/latest/meta-data/iam/info" | jq -r '.InstanceProfileArn')
RoleName=$(echo $RoleArn | cut -d '/' -f 2)
fi
if [ -n "$RoleName" ]; then
StsCredential=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s "http://169.254.169.254/latest/meta-data/iam/security-credentials/$RoleName")
if [ $(compgen -ac | sort | uniq | grep -x jq) ]; then
StsAccessKeyId=$(echo $StsCredential | jq -r '.AccessKeyId')
StsSecretAccessKey=$(echo $StsCredential | jq -r '.SecretAccessKey')
StsToken=$(echo $StsCredential | jq -r '.Token')
fi
fi
# AWS Account ID
if [ $(compgen -ac | sort | uniq | grep -x jq) ]; then
AwsAccountId=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -s "http://169.254.169.254/latest/dynamic/instance-identity/document" | jq -r '.accountId')
fi
else
#-----------------------------------------------------------------------
# Retrieving Metadata Using the Instance Metadata Service v1 (IMDS v1)
#-----------------------------------------------------------------------
# Instance MetaData
Az=$(curl -s "http://169.254.169.254/latest/meta-data/placement/availability-zone")
AzId=$(curl -s "http://169.254.169.254/latest/meta-data/placement/availability-zone-id")
Region=$(curl -s "http://169.254.169.254/latest/meta-data/placement/region")
InstanceId=$(curl -s "http://169.254.169.254/latest/meta-data/instance-id")
InstanceType=$(curl -s "http://169.254.169.254/latest/meta-data/instance-type")
PrivateIp=$(curl -s "http://169.254.169.254/latest/meta-data/local-ipv4")
AmiId=$(curl -s "http://169.254.169.254/latest/meta-data/ami-id")
# IAM Role & STS Information
if [ $(compgen -ac | sort | uniq | grep -x jq) ]; then
RoleArn=$(curl -s "http://169.254.169.254/latest/meta-data/iam/info" | jq -r '.InstanceProfileArn')
RoleName=$(echo $RoleArn | cut -d '/' -f 2)
fi
if [ -n "$RoleName" ]; then
StsCredential=$(curl -s "http://169.254.169.254/latest/meta-data/iam/security-credentials/$RoleName")
if [ $(compgen -ac | sort | uniq | grep -x jq) ]; then
StsAccessKeyId=$(echo $StsCredential | jq -r '.AccessKeyId')
StsSecretAccessKey=$(echo $StsCredential | jq -r '.SecretAccessKey')
StsToken=$(echo $StsCredential | jq -r '.Token')
fi
fi
# AWS Account ID
if [ $(compgen -ac | sort | uniq | grep -x jq) ]; then
AwsAccountId=$(curl -s "http://169.254.169.254/latest/dynamic/instance-identity/document" | jq -r '.accountId')
fi
fi
#-------------------------------------------------------------------------------
# Custom Package Installation [AWS-CLI v2]
# https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html
#-------------------------------------------------------------------------------
# Package Uninstall AWS-CLI v1 Tools (from RPM Package)
if [ $(compgen -ac | sort | uniq | grep -x aws) ]; then
aws --version
which aws
if [ $(rpm -qa | grep aws-cli) ]; then
rpm -qi aws-cli
zypper --quiet --non-interactive remove aws-cli
fi
fi
# Prohibit installation of AWS-CLI v1 package from repository
zypper --quiet --non-interactive locks
zypper --quiet --non-interactive addlock aws-cli
zypper --quiet --non-interactive locks
# Package download AWS-CLI v2 Tools (from Bundle Installer)
curl -sS "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "/tmp/awscliv2.zip"
unzip -oq "/tmp/awscliv2.zip" -d /tmp/
# Package Install AWS-CLI v2 Tools (from Bundle Installer)
/tmp/aws/install -i "/opt/aws/awscli" -b "/usr/bin" --update
aws --version
# Configuration AWS-CLI tools
cat > /etc/bash_completion.d/aws_bash_completer << __EOF__
# Typically that would be added under one of the following paths:
# - /etc/bash_completion.d
# - /usr/local/etc/bash_completion.d
# - /usr/share/bash-completion/completions
complete -C aws_completer aws
__EOF__
# Setting AWS-CLI default Region & Output format
aws configure << __EOF__
${Region}
json
__EOF__
# Setting AWS-CLI Logging
aws configure set cli_history enabled
# Setting AWS-CLI Pager settings
aws configure set cli_pager ''
# Getting AWS-CLI default Region & Output format
aws configure list
cat ~/.aws/config
# Get AWS Region Information
if [ -n "$RoleName" ]; then
echo "# Get AWS Region Infomation"
aws ec2 describe-regions --region ${Region}
fi
# Get AMI information of this EC2 instance
if [ -n "$RoleName" ]; then
echo "# Get AMI information of this EC2 instance"
aws ec2 describe-images --image-ids ${AmiId} --output json --region ${Region}
fi
# Get the latest AMI information of the OS type of this EC2 instance from Public AMI
SapFlag=0
SapFlag=$(find /etc/zypp/repos.d/ -name "*SLE-Product-SLES_SAP15*" | wc -l)
if [ $SapFlag -gt 0 ]; then
if [ -n "$RoleName" ]; then
echo "SUSE Linux Enterprise Server for SAP Applications 15"
echo "# Get Newest AMI Information from Public AMI (AWS Martketplace/PAYG)"
ProductCodes=$(curl -s "http://169.254.169.254/latest/meta-data/product-codes")
if [ -n "$ProductCodes" ]; then
NewestAmiId=$(aws ec2 describe-images --owners aws-marketplace --filters "Name=product-code,Values=${ProductCodes}" --query "sort_by(Images, &CreationDate)[-1].[ImageId]" --output text --region ${Region})
aws ec2 describe-images --image-ids ${NewestAmiId} --output json --region ${Region}
else
NewestAmiId=$(aws ec2 describe-images --owners aws-marketplace --filters "Name=product-code,Values=6ajp9738nmxhrsj68dvuwztp9" --query "sort_by(Images, &CreationDate)[-1].[ImageId]" --output text --region ${Region})
aws ec2 describe-images --image-ids ${NewestAmiId} --output json --region ${Region}
fi
fi
else
if [ -n "$RoleName" ]; then
echo "SUSE Linux Enterprise Server 15 (non SUSE Linux Enterprise Server for SAP Applications 15)"
echo "# Get Newest AMI Information from Public AMI"
NewestAmiId=$(aws ec2 describe-images --owner 013907871322 --filter "Name=name,Values=suse-sles-15-*-hvm-ssd-x86_64" "Name=virtualization-type,Values=hvm" "Name=architecture,Values=x86_64" --query 'sort_by(Images[].{YMD:CreationDate,Name:Name,ImageId:ImageId},&YMD)' --output text --region ${Region} | grep -v byos | grep -v ecs | grep -v sapcal | sort -k 3 --reverse | head -n 1 | awk '{print $1}')
aws ec2 describe-images --image-ids ${NewestAmiId} --output json --region ${Region}
fi
fi
# Get the latest AMI information of the OS type of this EC2 instance from SUSE Public Cloud Info Service
# https://www.suse.com/c/suse-public-cloud-image-life-cycle/
# https://github.com/SUSE-Enceladus/public-cloud-info-client
if [ $(command -v pint) ]; then
pint amazon images --active --json --region=${Region}
fi
# Get EC2 Instance Information
if [ -n "$RoleName" ]; then
echo "# Get EC2 Instance Information"
aws ec2 describe-instances --instance-ids ${InstanceId} --output json --region ${Region}
fi
# Get EC2 Instance attached EBS Volume Information
if [ -n "$RoleName" ]; then
echo "# Get EC2 Instance attached EBS Volume Information"
aws ec2 describe-volumes --filters Name=attachment.instance-id,Values=${InstanceId} --output json --region ${Region}
fi
# Get EC2 Instance attached VPC Security Group Information
if [ -n "$RoleName" ]; then
echo "# Get EC2 Instance attached VPC Security Group Information"
aws ec2 describe-security-groups --group-ids $(aws ec2 describe-instances --instance-id ${InstanceId} --query "Reservations[].Instances[].SecurityGroups[].GroupId[]" --output text --region ${Region}) --output json --region ${Region}
fi
# Get EC2 Instance Attribute[Network Interface Performance Attribute]
#
# - Summary of Networking and Storage Features
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#instance-type-summary-table
# - ENA (Elastic Network Adapter)
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking-ena.html
# - SR-IOV
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sriov-networking.html
#
if [ -n "$RoleName" ]; then
if [[ "$InstanceType" =~ ^(a1.*|c5.*|c5a.*|c5ad.*|c5adn.*|c5an.*|c5d.*|c5n.*|e3.*|f1.*|g3.*|g3s.*|g4dn.*|h1.*|i3.*|i3en.*|i3p.*|m5.*|m5a.*|m5ad.*|m5d.*|m5dn.*|m5n.*|p2.*|p3.*|p3dn.*|r4.*|r5.*|r5a.*|r5ad.*|r5d.*|r5dn.*|r5n.*|t3.*|t3a.*|x1.*|x1e.*|z1d.*|m4.16xlarge|u-*tb1.metal)$ ]]; then
# Get EC2 Instance Attribute(Elastic Network Adapter Status)
echo "# Get EC2 Instance Attribute(Elastic Network Adapter Status)"
aws ec2 describe-instances --instance-id ${InstanceId} --query Reservations[].Instances[].EnaSupport --output json --region ${Region}
# Get Linux Kernel Module(modinfo ena)
echo "# Get Linux Kernel Module(modinfo ena)"
if [ $(lsmod | awk '{print $1}' | grep -x ena) ]; then
modinfo ena
fi
elif [[ "$InstanceType" =~ ^(c3.*|c4.*|d2.*|i2.*|r3.*|m4.*)$ ]]; then
# Get EC2 Instance Attribute(Single Root I/O Virtualization Status)
echo "# Get EC2 Instance Attribute(Single Root I/O Virtualization Status)"
aws ec2 describe-instance-attribute --instance-id ${InstanceId} --attribute sriovNetSupport --output json --region ${Region}
# Get Linux Kernel Module(modinfo ixgbevf)
echo "# Get Linux Kernel Module(modinfo ixgbevf)"
if [ $(lsmod | awk '{print $1}' | grep -x ixgbevf) ]; then
modinfo ixgbevf
fi
else
echo "# Not Target Instance Type :" $InstanceType
fi
fi
# Get EC2 Instance Attribute[Storage Interface Performance Attribute]
#
# - Summary of Networking and Storage Features
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#instance-type-summary-table
# - EBS Optimized Instance
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSPerformance.html
#
if [ -n "$RoleName" ]; then
if [[ "$InstanceType" =~ ^(a1.*|c1.*|c3.*|c4.*|c5.*|c5a.*|c5ad.*|c5adn.*|c5an.*|c5d.*|c5n.*|d2.*|e3.*|f1.*|g2.*|g3.*|g3s.*|g4dn.*|h1.*|i2.*|i3.*|i3en.*|i3p.*|m1.*|m2.*|m3.*|m4.*|m5.*|m5a.*|m5ad.*|m5d.*|m5dn.*|m5n.*|p2.*|p3.*|p3dn.*|r3.*|r4.*|r5.*|r5a.*|r5ad.*|r5d.*|r5dn.*|r5n.*|t3.*|t3a.*|x1.*|x1e.*|z1d.*|u-*tb1.metal)$ ]]; then
# Get EC2 Instance Attribute(EBS-optimized instance Status)
echo "# Get EC2 Instance Attribute(EBS-optimized instance Status)"
aws ec2 describe-instance-attribute --instance-id ${InstanceId} --attribute ebsOptimized --output json --region ${Region}
# Get Linux Block Device Read-Ahead Value(blockdev --report)
echo "# Get Linux Block Device Read-Ahead Value(blockdev --report)"
blockdev --report
else
# Get Linux Block Device Read-Ahead Value(blockdev --report)
echo "# Get Linux Block Device Read-Ahead Value(blockdev --report)"
blockdev --report
fi
fi
# Get EC2 Instance attached NVMe Device Information
#
# - Summary of Networking and Storage Features
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#instance-type-summary-table
#
# - Nitro-based Instances
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances
# - Amazon EBS and NVMe Volumes
# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-ebs-volumes.html
# - SSD Instance Store Volumes
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ssd-instance-store.html
#
if [ -n "$RoleName" ]; then
if [[ "$InstanceType" =~ ^(a1.*|c5.*|c5a.*|c5ad.*|c5adn.*|c5an.*|c5d.*|c5n.*|f1.*|g4dn.*|i3.*|i3en.*|i3p.*|m5.*|m5a.*|m5ad.*|m5d.*|m5dn.*|m5n.*|p3dn.*|r5.*|r5a.*|r5ad.*|r5d.*|r5dn.*|r5n.*|t3.*|t3a.*|z1d.*|u-*tb1.metal)$ ]]; then
# Get Linux Kernel Module(modinfo nvme)
echo "# Get Linux Kernel Module(modinfo nvme)"
if [ $(lsmod | awk '{print $1}' | grep -x nvme) ]; then
modinfo nvme
fi
# Get NVMe Device(nvme list)
# http://www.spdk.io/doc/nvme-cli.html
# https://github.com/linux-nvme/nvme-cli
if [ $(lsmod | awk '{print $1}' | grep -x nvme) ]; then
if [ $(command -v nvme) ]; then
echo "# Get NVMe Device(nvme list)"
nvme list
fi
fi
# Get PCI-Express Device(lspci -v)
if [ $(command -v lspci) ]; then
echo "# Get PCI-Express Device(lspci -v)"
lspci -v
fi
# Get Disk[MountPoint] Information (lsblk -a)
if [ $(command -v lsblk) ]; then
echo "# Get Disk[MountPoint] Information (lsblk -a)"
lsblk -a
fi
else
echo "# Not Target Instance Type :" $InstanceType
fi
fi
#-------------------------------------------------------------------------------
# Custom Package Installation [AWS Systems Manager agent (aka SSM agent)]
# http://docs.aws.amazon.com/ja_jp/systems-manager/latest/userguide/sysman-install-ssm-agent.html
# https://github.com/aws/amazon-ssm-agent
#-------------------------------------------------------------------------------
zypper --quiet --non-interactive --no-gpg-checks install "https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm"
rpm -qi amazon-ssm-agent
systemctl daemon-reload
systemctl restart amazon-ssm-agent
systemctl status -l amazon-ssm-agent
# Configure AWS Systems Manager Agent software (Start Daemon awsagent)
if [ $(systemctl is-enabled amazon-ssm-agent) = "disabled" ]; then
systemctl enable amazon-ssm-agent
systemctl is-enabled amazon-ssm-agent
fi
ssm-cli get-instance-information
#-------------------------------------------------------------------------------
# Custom Package Install [Amazon CloudWatch Agent]
# https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/download-cloudwatch-agent-commandline.html
# https://github.com/aws/amazon-cloudwatch-agent
#-------------------------------------------------------------------------------
zypper --quiet --non-interactive --no-gpg-checks install "https://s3.amazonaws.com/amazoncloudwatch-agent/suse/amd64/latest/amazon-cloudwatch-agent.rpm"
rpm -qi amazon-cloudwatch-agent
cat /opt/aws/amazon-cloudwatch-agent/bin/CWAGENT_VERSION
cat /opt/aws/amazon-cloudwatch-agent/etc/common-config.toml
systemctl daemon-reload
# Configure Amazon CloudWatch Agent software (Start Daemon awsagent)
if [ $(systemctl is-enabled amazon-cloudwatch-agent) = "disabled" ]; then
systemctl enable amazon-cloudwatch-agent
systemctl is-enabled amazon-cloudwatch-agent
fi
# Configure Amazon CloudWatch Agent software (Monitor settings)
curl -sS ${CWAgentConfig} -o "/tmp/config.json"
cat "/tmp/config.json"
/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/tmp/config.json -s
/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a stop
/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a start
systemctl status -l amazon-cloudwatch-agent
/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a status
# View Amazon CloudWatch Agent config files
cat /opt/aws/amazon-cloudwatch-agent/etc/common-config.toml
cat /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.toml
#-------------------------------------------------------------------------------
# Custom Package Installation [Amazon EC2 Rescue for Linux (ec2rl)]
# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Linux-Server-EC2Rescue.html
# https://github.com/awslabs/aws-ec2rescue-linux
#-------------------------------------------------------------------------------
# Package Amazon EC2 Administration Tools (from S3 Bucket)
curl -sS "https://s3.amazonaws.com/ec2rescuelinux/ec2rl-bundled.tgz" -o "/tmp/ec2rl-bundled.tgz"
mkdir -p "/opt/aws"
rm -rf /opt/aws/ec2rl*
tar -xzf "/tmp/ec2rl-bundled.tgz" -C "/opt/aws"
mv --force /opt/aws/ec2rl* "/opt/aws/ec2rl"
cat > /etc/profile.d/ec2rl.sh << __EOF__
export PATH=\$PATH:/opt/aws/ec2rl
__EOF__
source /etc/profile.d/ec2rl.sh
# Check Version
/opt/aws/ec2rl/ec2rl version
/opt/aws/ec2rl/ec2rl list
# Required Software Package
/opt/aws/ec2rl/ec2rl software-check
# Diagnosis [dig modules]
# /opt/aws/ec2rl/ec2rl run --only-modules=dig --domain=amazon.com
#-------------------------------------------------------------------------------
# Custom Package Installation [Ansible]
# https://packagehub.suse.com/packages/ansible/
#-------------------------------------------------------------------------------
# Package Install SLES System Administration Tools (from SUSE Package Hub Repository)
# zypper --quiet --non-interactive install ansible
# ansible --version
# ansible localhost -m setup
#-------------------------------------------------------------------------------
# Custom Package Clean up
#-------------------------------------------------------------------------------
zypper clean --all
zypper --quiet refresh -fdb
zypper --quiet --non-interactive update
#-------------------------------------------------------------------------------
# System information collection
#-------------------------------------------------------------------------------
# CPU Information [cat /proc/cpuinfo]
cat /proc/cpuinfo
# CPU Information [lscpu]
lscpu
lscpu --extended
# Memory Information [cat /proc/meminfo]
cat /proc/meminfo
# Memory Information [free]
free
# Disk Information(Partition) [parted -l]
parted -l
# Disk Information(MountPoint) [lsblk -f]
lsblk -f
# Disk Information(File System) [df -khT]
df -khT
# Network Information(Network Interface) [ip addr show]
ip addr show
# Network Information(Routing Table) [ip route show]
ip route show
# Network Information(Firewall Service) [SuSEfirewall2]
if [ $(command -v SuSEfirewall2) ]; then
if [ $(systemctl is-enabled SuSEfirewall2) = "enabled" ]; then
# Network Information(Firewall Service) [SuSEfirewall2 status]
# https://en.opensuse.org/SuSEfirewall2
SuSEfirewall2 status
fi
fi
# Linux Security Information(AppArmor)
if [ $(command -v rcapparmor) ]; then