forked from adoptium/infrastructure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aix.yml.old
978 lines (854 loc) · 30.7 KB
/
aix.yml.old
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
---
########################################
# AdoptOpenJDK - Ansible Playbook for: #
# --------------- AIX --------------- #
########################################
- name: AIX old play
hosts: all
remote_user: root
become: yes
environment:
PATH: "/opt/IBM/xlC/13.1.3/bin:/opt/freeware/bin:{{ ansible_env.PATH }}"
PERL_MB_OPT: "--install_base /opt/freeware"
PERL_MM_OPT: "INSTALL_BASE=/opt/freeware"
vars:
swap_size: 4096
tasks:
- block:
# Set standard variables
- name: Load AdoptOpenJDKs variable file
include_vars: ./adoptopenjdk_variables.yml
# Install bash if it's not already there
- name: Check if bash is installed
shell: bash --version >/dev/null 2>&1
register: does_bash_exist
failed_when: false
- name: Install bash
yum: name=bash state=present update_cache=yes
when: does_bash_exist.rc != 0
################################
# AIX filesystem configuration #
################################
- name: Download AIX filesystem configuration script
get_url:
url: https://raw.githubusercontent.com/adoptium/infrastructure/master/ansible/playbooks/scripts/AIX_filesystem_config.sh
dest: /tmp/AIX_filesystem_config.sh
mode: 0775
validate_certs: no
tags: filesystem
- name: Execute AIX filesystem configuration script
command: /tmp/AIX_filesystem_config.sh
tags: filesystem
- name: Remove AIX filesystem configuration script
file:
state: absent
path: /tmp/AIX_filesystem_config.sh
tags: filesystem
################################
# AIX RAMDISK configuration #
################################
- name: Create /usr/local/bin if it doesn't exist
file:
path: /usr/local/bin
state: directory
tags: ramdisk
- name: Update inittab
lineinfile:
line: "ramdisk:2:once:/usr/local/bin/AIX_ramdisk.ksh >/dev/null 2>&1"
path: /etc/inittab
tags: ramdisk
- name: Check if AIX_ramdisk.ksh exists
stat:
path: /usr/local/bin/AIX_ramdisk.ksh
register: ramdisk_script_exists
tags: ramdisk
- name: Download AIX ramdisk script
get_url:
url: https://raw.githubusercontent.com/adoptium/infrastructure/master/ansible/playbooks/scripts/AIX_ramdisk.ksh
dest: /usr/local/bin/AIX_ramdisk.ksh
mode: 0775
validate_certs: no
when: not ramdisk_script_exists.stat.exists
tags: ramdisk
##################################################################
# Install openssl from IBM installp #
# openssl installp download requiring an IBMid #
# https://www-01.ibm.com/support/docview.wss?uid=isg3T1027135 #
##################################################################
- name: Check if openssl is installed
shell: openssl version >/dev/null 2>&1
register: does_openssl_exist
failed_when: false
tags: openssl
- name: Transfer Openssl to remote host
copy:
src: /Vendor_Files/aix/openssl/openssl-1.0.2.1601.tar.Z
dest: /tmp/openssl-1.0.2.1601.tar.Z
when: does_openssl_exist.rc != 0
tags: openssl
- name: Extract Openssl
shell: uncompress /tmp/openssl-1.0.2.1601.tar.Z | tar xf - -C /tmp/
when: does_openssl_exist.rc != 0
tags: openssl
- name: Install IBM Openssl - installp
command: installp -aXYgd /tmp/openssl-1.0.2.1601 openssl.base
register: result.openssl
failed_when: false
when: does_openssl_exist.rc != 0
tags: openssl
- name: Clean openssl tmp files
file:
path: "{{ item }}"
state: absent
with_items:
- /tmp/openssl-1.0.2.1601
- /tmp/openssl-1.0.2.1601.tar.Z
when: does_openssl_exist.rc != 0
tags: openssl
####################################################
# Uninstall conflicting packages from base image #
# if they were installed via rpm unless yum exists #
####################################################
- name: Confirm yum is installed - /usr/bin/yum
stat:
path: /usr/bin/yum
register: yum
- name: Uninstall conflicting packages
shell: rpm -e --nodeps $(rpm -qa | grep -E "cloud-init|perl|openssl") 2>/dev/null
failed_when: false
when: yum.stat.islnk is not defined
tags:
- rpm_remove
# TODO: rpm used in place of yum or rpm_key module
- skip_ansible_lint
####################################
# Install yum and update to latest #
####################################
- name: Download yum.sh
get_url:
url: ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/ezinstall/ppc/yum.sh
validate_certs: False
dest: /tmp/
mode: 0775
timeout: 25
when: yum.stat.islnk is not defined
tags: yum
- name: Install yum and dependencies
command: /tmp/yum.sh
register: result.yum
failed_when: false
when: yum.stat.islnk is not defined
tags:
- yum
# TODO: Package installs should not use latest
- skip_ansible_lint
- name: Yum update
yum:
update_cache: yes
name: '*'
state: latest
tags:
- yum
# TODO: Package installs should not use latest
- skip_ansible_lint
- name: Install yum package support
yum: name={{ item }} state=present update_cache=yes
with_items:
- autoconf
- bc
- bison
- coreutils
- cpio
- cups-devel
- cups-libs
- expect
- flex
- freetype2-devel
- fontconfig-devel
- gawk
- git
- grep
- libXrender-devel
- libffi-devel
- make
- m4
- pcre
- pkg-config
- popt
- sed
- sudo
- tar
- tcl
- tk
- unzip
- wget
- xz-libs
- zip
- zsh
tags: yum
##############################################
# Additional Tools not available through yum #
##############################################
- name: Install yum package support
yum: name={{ item }} state=present update_cache=yes
with_items:
- http://www.bullfreeware.com/download/bin/2328/libiconv-1.14-22.aix6.1.ppc.rpm
- http://www.bullfreeware.com/download/bin/2591/libunistring-0.9.6-2.aix6.1.ppc.rpm
- http://www.bullfreeware.com/download/bin/3944/perl-5.24.0-3.aix6.1.ppc.rpm
- http://www.oss4aix.org/download/RPMS/cmake/cmake-3.7.2-1.aix6.1.ppc.rpm
tags: rpm_install
- name: Ensure perl from /opt/freeware/bin is the default in /usr/bin
shell: mv /usr/bin/perl /usr/bin/perl.old && ln -s /opt/freeware/bin/perl /usr/bin/
failed_when: false
tags: rpm_install
##############
# Boot JDK 7 #
##############
- name: Check for Java7 availability
stat:
path: /usr/j2sdk-image
register: java7
tags: java7
- name: Transfer and Extract Java7
unarchive:
src: /Vendor_Files/aix/openjdk-7u-aix.tar
dest: /usr
remote_src: no
when: java7.stat.isdir is not defined
tags: java7
##############
# Boot JDK 8 #
##############
- name: Get java8 path information
stat:
path: /usr/java8_64
register: java8
tags: java8
- name: Transfer and Extract AdoptOpenJDK 8
unarchive:
src: https://api.adoptopenjdk.net/v3/binary/latest/8/ga/aix/ppc64/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk
dest: /usr
remote_src: yes
when: java8.stat.isdir is not defined
tags: java8
- name: Find java8 directory
find:
file_type: directory
paths: /usr
patterns: 'jdk8u*'
when: java8.stat.isdir is not defined
register: java8_files_matched
tags: java8
- name: Symlink to java8_64
file:
src: "{{ item.path }}"
dest: /usr/java8_64
state: link
with_items:
- "{{ java8_files_matched.files }}"
when: java8.stat.isdir is not defined
tags: java8
- name: Setting Java 8 as default
file:
src: /usr/java8_64
dest: /usr/bin/java
state: link
tags: java8
##############
# Boot JDK 9 #
##############
- name: Check for Java9 availability
stat:
path: /usr/java9_64
register: java9
tags: java9
- name: Transfer and Extract AdoptOpenJDK 9
unarchive:
src: https://api.adoptopenjdk.net/v3/binary/latest/9/ga/aix/ppc64/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk
dest: /usr
remote_src: yes
when: java9.stat.isdir is not defined
tags: java9
- name: Find java9 directory
find:
file_type: directory
paths: /usr
patterns: 'jdk-9*'
when: java9.stat.isdir is not defined
register: java9_files_matched
tags: java9
- name: Symlink to java9_64
file:
src: "{{ item.path }}"
dest: /usr/java9_64
state: link
with_items:
- "{{ java9_files_matched.files }}"
when: java9.stat.isdir is not defined
tags: java9
#################
# OpenJ9 JDK 10 #
#################
- name: Check for Java10 availability
stat:
path: /usr/java10_64
register: java10
tags: java10
- name: Transfer and Extract AdoptOpenJDK 10
unarchive:
src: https://api.adoptopenjdk.net/v3/binary/latest/10/ga/aix/ppc64/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk
dest: /usr
remote_src: yes
when: java10.stat.isdir is not defined
tags: java10
- name: Find java10 directory
find:
file_type: directory
paths: /usr
patterns: 'jdk-10*'
when: java10.stat.isdir is not defined
register: java10_files_matched
tags: java10
- name: Symlink to java10_64
file:
src: "{{ item.path }}"
dest: /usr/java10_64
state: link
with_items:
- "{{ java10_files_matched.files }}"
when: java10.stat.isdir is not defined
tags: java10
#################
# OpenJ9 JDK 11 #
#################
- name: Check for Java11 availability
stat:
path: /usr/java11_64
register: java11
tags: java11
- name: Transfer and Extract AdoptOpenJDK 11
unarchive:
src: https://api.adoptopenjdk.net/v3/binary/latest/11/ga/aix/ppc64/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk
dest: /usr
remote_src: yes
when: java11.stat.isdir is not defined
tags: java11
- name: Find java11 directory
find:
file_type: directory
paths: /usr
patterns: 'jdk-11*'
when: java11.stat.isdir is not defined
register: java11_files_matched
tags: java11
- name: Symlink to java11_64
file:
src: "{{ item.path }}"
dest: /usr/java11_64
state: link
with_items:
- "{{ java11_files_matched.files }}"
when: java11.stat.isdir is not defined
tags: java11
#################
# OpenJ9 JDK 12 #
#################
- name: Check for Java12 availability
stat:
path: /usr/java12_64
register: java12
tags: java12
- name: Transfer and Extract AdoptOpenJDK 12
unarchive:
src: https://api.adoptopenjdk.net/v3/binary/latest/12/ga/aix/ppc64/jdk/{{ bootjdk }}/normal/adoptopenjdk?project=jdk
dest: /usr
remote_src: yes
when: java12.stat.isdir is not defined
tags: java12
- name: Find java12 directory
find:
file_type: directory
paths: /usr
patterns: 'jdk-12*'
when: java12.stat.isdir is not defined
register: java12_files_matched
tags: java12
- name: Symlink to java12_64
file:
src: "{{ item.path }}"
dest: /usr/java12_64
state: link
with_items:
- "{{ java12_files_matched.files }}"
when: java12.stat.isdir is not defined
tags: java12
#########################################################################
# Install X11 extensions #
# x11.adt.ext installp download requiring an IBMid #
# https://www-01.ibm.com/support/docview.wss?uid=isg1fileset-1198156818 #
# x11.vfb installp download requiring an IBMid #
# http://www-01.ibm.com/support/docview.wss?uid=isg1fileset-2054486724 #
#########################################################################
- name: Check if X11.adt.ext is installed
shell: lslpp -l X11.adt.ext >/dev/null 2>&1
register: does_X11_adt_ext_exist
failed_when: false
tags: x11
- name: Check if X11.vfb is installed
shell: lslpp -l X11.vfb >/dev/null 2>&1
register: does_x11_exist
failed_when: false
tags: x11
- name: Transfer and extract X11
unarchive:
src: /Vendor_Files/aix/OpenGL_X11.tar
dest: /tmp
remote_src: no
when: does_x11_exist.rc != 0 or does_X11_adt_ext_exist.rc != 0
tags: x11
- name: Install IBM X11 Extensions - installp
command: installp -aXYgd /tmp/x11/X11.adt X11.adt.ext
register: result.x11
failed_when: false
when: does_X11_adt_ext_exist.rc != 0
tags: x11
- name: Install X11.vfb - installp
command: installp -agXYd /tmp/x11/X11.vfb all
register: result.x11.vfb
failed_when: false
when: does_x11_exist.rc != 0
tags: x11
- name: Remove X11 install files
file:
state: absent
path: /tmp/x11
when: does_x11_exist.rc != 0 or does_X11_adt_ext_exist.rc != 0
tags: x11
###################
# IBM XL C 13.1.3 #
###################
- name: Checking for XLC13 availability
stat:
path: /opt/IBM/xlC/13.1.3/bin/xlc
register: xlc13
tags: xlc13
- debug:
msg: "xlc13 installed, skipping download and installation"
when: xlc13.stat.islnk is defined
tags: xlc13
- name: Transfer and Extract XLC13
unarchive:
src: /Vendor_Files/aix/XLC/IBM_XL_C_C___FOR_AIX_V13.1.3_EMG.tar.gz
dest: /tmp
remote_src: no
when: xlc13.stat.islnk is not defined
tags: xlc13
- name: Install IBM XLC13 - installp
command: installp -aXYg -e /tmp/usr/install.log -d /tmp/usr/sys/inst.images all
register: result.xlc
failed_when: false
when: xlc13.stat.islnk is not defined
tags: xlc13
- debug: msg='Erorrs from the previous installp command normal'
when: xlc13.stat.islnk is not defined
tags: xlc13
- name: TestIBM XLC13
command: /opt/IBM/xlC/13.1.3/bin/xlc -qversion
register: xlc13_qversion
tags: xlc13
- name: Display XLC13 qversion information
debug:
msg: "{{ xlc13_qversion.stdout }}"
tags: xlc13
- name: Symlink - /usr/bin/xlc
file: src=/opt/IBM/xlC/13.1.3/bin/xlc dest=/usr/bin/xlc state=link
when: xlc13.stat.islnk is not defined
tags: xlc13
- name: Symlink - /usr/bin/xlc++
file: src=/opt/IBM/xlC/13.1.3/bin/xlc++ dest=/usr/bin/xlc++ state=link
when: xlc13.stat.islnk is not defined
tags: xlc13
- name: Symlink - /usr/bin/xlC
file: src=/opt/IBM/xlC/13.1.3/bin/xlC dest=/usr/bin/xlC state=link
when: xlc13.stat.islnk is not defined
tags: xlc13
- name: Symlink - /usr/bin/xlc_r
file: src=/opt/IBM/xlC/13.1.3/bin/xlc_r dest=/usr/bin/xlc_r state=link
when: xlc13.stat.islnk is not defined
tags: xlc13
- name: Symlink - /usr/bin/xlC_r
file: src=/opt/IBM/xlC/13.1.3/bin/xlc_r dest=/usr/bin/xlC_r state=link
when: xlc13.stat.islnk is not defined
tags: xlc13
- name: Symlink - /usr/bin/gxlC
file: src=/opt/IBM/xlC/13.1.3/bin/gxlC dest=/usr/bin/gxlC state=link
when: xlc13.stat.islnk is not defined
tags: xlc13
- name: Clean XLC13 tmp files
file:
path: /tmp/usr
state: absent
tags: xlc13
###################
# IBM XL C 16.1.0 #
###################
- name: Checking for XLC16 availability
stat:
path: /opt/IBM/xlc/16.1.0/bin/xlc
register: xlc16
tags: xlc16
- debug:
msg: "xlc16 installed, skipping download and installation"
when: xlc16.stat.islnk is defined
tags: xlc16
- name: Transfer and Extract XLC16
unarchive:
src: /Vendor_Files/aix/XLC/XL_C_Cpp_FOR_AIX_V16.1_EMG.tar.Z
dest: /tmp
remote_src: no
when: xlc16.stat.islnk is not defined
tags: xlc16
- name: Install IBM XLC16 - installp
command: installp -aXYg -e /tmp/usr/install.log -d /tmp/usr/sys/inst.images all
register: result.xlc
failed_when: false
when: xlc16.stat.islnk is not defined
tags: xlc16
- debug: msg='Erorrs from the previous installp command normal'
when: xlc16.stat.islnk is not defined
tags: xlc16
- name: TestIBM XLC16
command: /opt/IBM/xlC/16.1.0/bin/xlc -qversion
register: xlc16_qversion
tags: xlc16
- name: Display XLC16 qversion information
debug:
msg: "{{ xlc16_qversion.stdout }}"
tags: xlc16
- name: Clean XLC16 tmp files
file:
path: /tmp/usr
state: absent
tags: xlc16
###############
# ant #
###############
- name: Checking for Ant availability
stat:
path: /usr/bin/ant
register: ant
tags: ant
- debug:
msg: "Ant installed, skipping download and installation"
when: ant.stat.islnk is defined
tags: ant
- name: Download and extract ant
unarchive:
src: https://archive.apache.org/dist/ant/binaries/apache-ant-1.9.9-bin.zip
dest: /opt
remote_src: yes
when: ant.stat.islnk is not defined
tags: ant
- name: Create symlink for ant
file: src=/opt/apache-ant-1.9.9/bin/ant dest=/usr/bin/ant state=link
when: ant.stat.islnk is not defined
tags: ant
###############
# ant-contrib #
###############
- name: Checking for ant-contrib availability
stat:
path: /opt/apache-ant-1.9.9/lib/ant-contrib.jar
register: antcontrib
tags: ant-contrib
- debug:
msg: "ant-contrib.jar installed, skipping download"
when: not antcontrib.stat.exists
tags: ant-contrib
- name: Download and extract ant-contrib
unarchive:
src: https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.tar.gz
dest: /tmp/
remote_src: yes
when: not antcontrib.stat.exists
tags: ant-contrib
- name: Move ant-contrib.jar to lib folder
command: mv /tmp/ant-contrib/lib/ant-contrib.jar /opt/apache-ant-1.9.9/lib/
when: not antcontrib.stat.exists
tags: ant-contrib
- name: Clean ant-contrib tmp files
file:
path: "{{ item }}"
state: absent
with_items:
- /tmp/ant-contrib
- /tmp/ant-contrib-1.0b2-bin.tar.gz
tags: ant-contrib
#########################
# Configure system logs #
#########################
- name: Ensure /etc/syslog.conf entries are present
blockinfile:
backup: yes
dest: /etc/syslog.conf
block: |
*.debug;*.emerg;*.alert;*.crit;*.warning /var/log/messages rotate size 1000k files 4
syslog.debug /var/log/syslog rotate size 1000k files 4
*.err;kern.debug;daemon.notice;mail.crit /var/adm/messages rotate size 1000k files 4
tags: syslog
- name: Ensure log files exist
file:
path: "{{ item }}"
state: touch
mode: 0644
with_items:
- /var/log/syslog
- /var/adm/messages
- /var/log/messages
changed_when: False
tags: syslog
- name: Reload syslogd
service: name=syslogd state=reloaded
changed_when: False
tags: syslog
- name: Ensure full core files are enabled
command: chdev -l sys0 -a fullcore=true
changed_when: False
tags: syslog
######################################
# Add bash to available login shells #
######################################
- name: Add bash to available login shells
replace:
path: /etc/security/login.cfg
regexp: 'shells = '
replace: 'shells = /bin/bash,'
tags: login_shell
- name: Add bash to available login shells
blockinfile:
dest: /etc/shells
block: |
/bin/bash
tags: login_shell
- name: Set variables for global environment
blockinfile:
dest: /etc/environment
block: |
AIXTHREAD_HRT=true
PKG_CONFIG_PATH=/opt/freeware/lib64/pkgconfig:/opt/freeware/lib/pkgconfig
PERL5LIB=/opt/freemarker/lib/perl5
tags: login_shell
- name: Add freeware and xlc to PATH for global environment
replace:
path: /etc/environment
regexp: 'PATH=/usr/bin'
replace: 'PATH=/opt/freeware/bin:/opt/IBM/xlC/13.1.3/bin:/usr/bin'
tags: login_shell
################
# Jenkins user #
################
- name: Check for user directory existence
stat:
path: /home/{{ Jenkins_Username }}
register: jenkins
tags: jenkins_user
- debug:
msg: "{{ Jenkins_Username }} home directory found, skipping user creation tasks"
when: jenkins.stat.isdir is defined
tags: jenkins_user
- name: Create jenkins user
command: mkuser home="/home/{{ Jenkins_Username }}" shell="/bin/bash" {{ Jenkins_Username }}
failed_when: false
when: jenkins.stat.isdir is not defined
tags: jenkins_user
- name: Create SSH Key folder for {{ Jenkins_Username }}
file:
path: /home/{{ Jenkins_Username }}/.ssh
owner: "{{ Jenkins_Username }}"
group: staff
mode: 0700
state: directory
when: jenkins.stat.isdir is not defined
tags: jenkins_user
- name: Set authorized key for jenkins user
authorized_key:
user: "{{ Jenkins_Username }}"
state: present
key: "{{ lookup('file', '{{ Jenkins_User_SSHKey }}') }}"
when: jenkins.stat.isdir is not defined
tags: jenkins_user
# Use the system defaults as defined in /etc/environment
- name: Remove .profile
file:
state: absent
path: /home/{{ Jenkins_Username }}/.profile
tags: jenkins_user
- name: Set user capabilites
command: chuser capabilities=CAP_NUMA_ATTACH,CAP_BYPASS_RAC_VMM,CAP_PROPAGATE {{ Jenkins_Username }}
tags: jenkins_user
- name: Set group capabilites
command: chgroup adms=root staff
tags: jenkins_user
- name: ensure adequate limits are set in /etc/security/limits
command: chsec -f /etc/security/limits -s {{ Jenkins_Username }} -a {{ item }}
with_items:
- "fsize=-1"
- "core=-1"
- "cpu=-1"
- "data=262144"
- "rss=65536"
- "stack=65536"
- "core_hard=-1"
- "nofiles=-1"
- "nofiles_hard=-1"
changed_when: False
tags: jenkins_user
##############
# freemarker #
##############
- name: Check for freemarker.jar existence
stat:
path: /home/{{ Jenkins_Username }}/freemarker.jar
register: freemarker
tags: freemarker
- debug:
msg: "freemarker.jar found, skipping download"
when: not freemarker.stat.exists
tags: freemarker
- name: Download and extract freemarker.jar
unarchive:
src: https://sourceforge.net/projects/freemarker/files/freemarker/2.3.8/freemarker-2.3.8.tar.gz
dest: /tmp/
remote_src: yes
owner: "{{ Jenkins_Username }}"
group: staff
mode: 0755
when: not freemarker.stat.exists
tags: freemarker
- name: Move freemarker.jar to /home/{{ Jenkins_Username }} folder
command: mv /tmp/freemarker-2.3.8/lib/freemarker.jar /home/{{ Jenkins_Username }}
when: not freemarker.stat.exists
tags: freemarker
- name: Clean freemarker tmp files
file:
path: "{{ item }}"
state: absent
with_items:
- /tmp/freemarker-2.3.8
- /tmp/freemarker-2.3.8.tar.gz
tags: freemarker
##################
# Nagios plugins #
##################
- name: Include Nagios Playbook
include_tasks: nagios/nagios_aix.yml
when: Nagios_Plugins == "Enabled"
tags: nagios
#####################
# superuser account #
#####################
- name: Setup zeus user
command: mkuser home="/home/zeus" shell="/usr/bin/ksh" zeus
failed_when: false
when: Superuser_Account == "Enabled"
tags: superuser
- name: Create SSH Key folder for zeus
file:
path: /home/zeus/.ssh
owner: zeus
group: staff
mode: 0700
state: directory
when: Superuser_Account == "Enabled"
tags: superuser
- name: Add key
authorized_key:
user: zeus
state: present
key: "{{ lookup('file', '{{ Zeus_User_SSHKey }}') }}"
when: Superuser_Account == "Enabled"
tags: superuser
- name: Grant zeus sudo powers
lineinfile:
dest: /etc/sudoers
state: present
regexp: '^zeus'
line: 'zeus ALL=(ALL) NOPASSWD: ALL'
when: Superuser_Account == "Enabled"
tags: superuser
###################
# NTP Time Server #
###################
- name: ensure NTP daemon is enabled
replace:
dest: /etc/rc.tcpip
regexp: '^ *# *(start /usr/sbin/xntpd (.+)\n)'
replace: '\1'
tags: ntp
- name: ensure NTP daemon is configured
copy:
content: |
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org
driftfile /etc/ntp.drift
tracefile /etc/ntp.trace
dest: /etc/ntp.conf
owner: root
group: system
mode: 0664
tags: ntp
- name: Stop NTP daemon
service: name=xntpd state=stopped
changed_when: False
tags: ntp
- name: Start NTP daemon
service: name=xntpd state=started
changed_when: False
tags: ntp
####################
# Disable sendmail #
####################
- name: Ensure sendmail is stopped
service: name=sendmail state=stopped
tags: sendmail
- name: Ensure sendmail is disabled
replace:
dest: /etc/rc.tcpip
regexp: '^ *(start /usr/lib/sendmail (.+)\n)'
replace: '#\1'
tags: sendmail
############################
# Enable full core support #
############################
- name: Ensure full AIX core files are enabled
command: chdev -l sys0 -a fullcore=true
changed_when: False
tags: fullcore
#####################
# Enable swap space #
#####################
- name: Ensure swap space is of adequate size
shell: |
swap_line=$(lsps -a | tail -n 1)
curr_swap_size=$(echo $swap_line | awk '{print $4}' | awk -FM '{print $1}')
swap_lv=$(echo $swap_line | awk '{print $1}')
if [[ $curr_swap_size -lt {{ swap_size }} ]]
then
echo "Extending swap LV..."
extendlv $swap_lv $(expr {{ swap_size }} - $curr_swap_size)M
fi
register: extendlv_result
changed_when: "'Extending' in extendlv_result.stdout"
notify:
- restart machine
tags:
- swap
# Environment variables don't work as part of command
- skip_ansible_lint
handlers:
- name: Restart machine
shell: echo 'shutdown -r now "Triggered by Ansible updates."' | at now + 1 minutes
async: 1
poll: 0
failed_when: False