generated from HariSekhon/Template-Repo
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathanaconda-ks.cfg
390 lines (348 loc) · 9.52 KB
/
anaconda-ks.cfg
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
#
# Author: Hari Sekhon
# Date: 2023-05-31 00:15:17 +0100 (Wed, 31 May 2023)
# Originally circa 2008 - 2013
#
# vim:ts=4:sts=4:sw=4:et
#
# https://github.com/HariSekhon/Packer
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/HariSekhon
#
# ============================================================================ #
# R e d h a t A n a c o n d a K i c k s t a r t
# ============================================================================ #
# I used Kickstart in production on hundreds of CentOS servers circa 2008 - 2013 but CentOS is EOL now, so tested on Fedora instead
# https://docs.fedoraproject.org/en-US/fedora/f36/install-guide/appendixes/Kickstart_Syntax_Reference/
#
# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/system_design_guide/kickstart-script-file-format-reference_system-design-guide
# Find differences between kickstart versions Fedora 35 and 36 (must run on the later version of the OS so that pykickstart has the right info):
#
# ksverdiff -f F35 -t F36
# ============================================================================ #
##platform=x86, AMD64, or Intel EM64T
#%include /path/to/file
#%ksappend <url>
# 'install' was deprecated in Fedora 29 and removed in Fedora 34 - you may need this on older RHEL / CentOS installs
#install
text # default: graphical
# phone home to a listening VNC client to monitor the install graphically
#vnc [--host=hostname] [--port=port] [--password=password]
reboot # or halt or poweroff, but hands off to Packer to continue over SSH here
firstboot --disable # don't go into initial setup after install
#network --bootproto=dhcp --device=eth0 --onboot=on
firewall --disabled
#keyboard uk # unrecognized keymap breaks Rocky 9.2 installation
keyboard gb
#keyboard gb-mac # for VMs on Mac to get the pipe | symbol to work, although the backtick symbol then doesn't. 'localectl set-keymap gb-mac' if you want to do this later on a live running VM
lang en_GB
# install from a network location - eg. Cobbler
#url=https://server:443
#url --url=$tree # populated in Cobbler
#
#cdrom # for Packer
# don't install X - gets overridden if selected in %packages
skipx
#services --disable="avahi-daemon,avahi-dnsconfd,cups,gpm,pcscd,smb,snmpd,yum-updatesd"
#services --enable="ntpd"
selinux --permissive
#timezone Europe/London --utc
timezone UTC
# XXX: Edit
# python -c 'import crypt; print(crypt.crypt("My Password", "$6$My Salt"))'
#rootpw --plaintext packer
rootpw --iscrypted $y$j9T$9i1krngZEaM9H1GLrQ5H598i$cjag2PXFsglrA7vSC54kmwhvyyo2zCp/mREpYg2HUo7
#user --name=packer --groups=wheel --password=packer # Used by Packer's provisioners over SSH
user --name=packer --groups=wheel --password=$y$j9T$OHKJf5AaoFO8b2hZHhNZ8vlV$lHzQQf5c690oQpJkcHrNp28bzDwAcLkG40k6hg54/f1 --iscrypted
# Steps through every screen and takes screenshots to /root/anaconda-screenshots
#autostep --autoscreenshot
# 'auth' / 'authconfig' are deprecated - use 'authselect' instead - see:
#
# https://docs.fedoraproject.org/en-US/fedora/f36/install-guide/appendixes/Kickstart_Syntax_Reference/#sect-kickstart-commands-authconfig
#
#auth --useshadow --enablemd5
#
#pwpolicy name --minlen=10 --minquality=50 --strict --noempty --nochanges
#
#group mynewgroup
#
# Join an AD or IP domain - https://docs.fedoraproject.org/en-US/fedora/f36/install-guide/appendixes/Kickstart_Syntax_Reference/#sect-kickstart-commands-realm
#realm join domain ...
# ============================================================================ #
# Disk
#%include /tmp/part-include
# Not using ignoredisk or specifying disks to avoid having to duplicate configs for different VM builds. On bare-metal you may want to do this protect data disks though
#
# cannot specify multiple because results in this error:
#
# An error occurred during reading the kickstart file:
# Disk "sda" given in ignoredisk command does not exist.
#
# The installer will now terminate.
#
#ignoredisk --only-use=sda,vda
# sda on typical SCSI/Sata/Sas hardware or VIrtualBox
#ignoredisk --only-use=sda
# vda on Tart (arm)
#ignoredisk --only-use=vda
zerombr
bootloader --location=mbr # --boot-drive=sda
clearpart --all --initlabel # --drives=sda
autopart
#part /boot --fstype ext4 --size=100 --ondisk=sda
#part pv.0 --size=1024 --grow --ondisk=sda
#volgroup VolGroup00 pv.0
## percent causes logvol to not respect --maxsize at all... -h
#logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --grow --size=1024 --maxsize=51400 --recommended
#logvol /tmp --fstype ext3 --name=LogVol01 --vgname=VolGroup00 --grow --size=256 --maxsize=2048 --recommended --fsoptions=noexec,nodev,nosuid
#logvol swap --fstype swap --name=LogVol02 --vgname=VolGroup00 --grow --size=256 --maxsize=1024 --recommended
# ============================================================================ #
%packages
#@^server-product-environment
# @core
# @server-policy
# # pkgs not in core that are useful
# bind-utils
# mlocate
# parted # for partprobe
# traceroute
# wget
#
#-@core
#-@clustering
#-@cluster-storage
#-@dns-server
#-@development-libs
#-@openfabrics-enterprise-distribution
#-@development-tools
#-@dialup
#-@editors
#-@emacs
#-@engineering-and-scientific
#-@ftp-server
#-@gnome-desktop
#-@gnome-software-development
#-@games
#-@graphical-internet
#-@graphics
#-@java
#-@java-development
#-@kde-desktop
#-@kde-software-development
#-@legacy-network-server
#-@legacy-software-development
#-@mail-server
#-@miscallvars
#-@mysql
#-@network-server
#-@news-server
#-@office
#-@sql-server
#-@printing
#-@ruby
#-@server-cfg
#-@sound-and-video
#-@system-tools
#-@text-internet
#-@web-server
#-@smb-server
#-@x-software-development
#-@base-x
#-@xen
#-@kvm
#-@clustering
#-@cluster-storage
#-@base-system
#-@desktops
#-@apps
#-@servers
#-@development
#-@virtualization
#-@clustering
#-@cluster-storage
#epel-release
bc
binutils # contains old C tools like 'strings'
bind-utils # host / nslookup / dig commands
bzip2
curl
#direnv
dos2unix
#dstat # now pcp-system-tools
#emacs-nox
#ethtool
#gcc
#git
#golang
findutils # find and xargs
hostname
lsof
iptables
iputils # ping, arping, tracepath
#jq # not found
#make
net-tools # ifconfig, netstat, route, arp
#ntp # old package
#ntpsec # not found at kickstart installer time, despite being available later
open-vm-tools
openssh-clients
openssh-server
#parallel # not found any more
#pcp-system-tools # contains 'dstat' - not found at kickstart installer time, despite being available later
#perl
#python3
#python3-pip
procps-ng
#screen # was removed, which sucks, use tmux
#sysstat # contains 'sar' - not found at kickstart installer time, despite being available later
tar
tcpdump
#tmux # not found
vim-enhanced
wget
which
#yum-security
zip
unzip
unix2dos
-Deployment_Guide-en-US
#-acl # required by Systemd, breaks Rocky 9.2 installation
-aspell
-aspell-en
-atk
-authconfig
-autofs
-avahi
-bluez
-bluez-utils
-ccid
-conman
-coolkey
-crash
-cups
-dhcpv6-client
-dosfstools
-dump
-ecryptfs-utils
-eject
-fbset
-finger
-firstboot-tui
-ftp
-gnupg
-gtk2
-hal
-hicolor-icon-theme
-htmlview
-ifd-egate
-ipsec-tools
-iptables-ipv6
-iptstate
-irda-utils
-jwhois
-keyutils
-krb5-workstation
-ksh
-kudzu
-lftp
-logwatch
-mailcap
-mcelog
-mkbootdisk
-mtools
-mtr
-nano
-nc
#-newt # required by NetworkManager-tui, breaks Rocky 9.2 installation
-nfs-utils
-nscd
-nss_db
-nss_ldap
-ntsysv
-numactl
-oddjob
-oddjob-libs
-pam_krb5
-pam_pkcs11
-pam_smb
-pango.i386
-parted
-pcmciautils
-pcsc-lite
-pcsc-lite-libs
-pinfo
-pkinit-nss
-pm-utils
-portmap
-ppp
-rdate
-rdist
-rmt
-rp-pppoe
-rsh
-rsyslog
-setuptool
#-slang # required by newt, breaks Rock 9.2 installation
-stunnel
-symlinks
-sysfsutils
-syslinux
-system-config-network-tui
-system-config-securitylevel-tui
-talk
-telnet
-telnet-server
-trousers
-udftools
-usbutils
-wireless-tools.i386
-words
-wpa_supplicant
-xinetd
-xorg-x11-filesystem
-yp-tools
-ypbind
-yum-updatesd
%end
# ============================================================================ #
#%pre --interpreter=/usr/bin/python
%pre --log=/root/ks-pre.log
#!/bin/bash
set -euxo pipefail
echo
%end
# ============================================================================ #
#%post --interpreter=/usr/bin/python
%post --log=/root/ks-post.log
#!/bin/bash
set -euxo pipefail
export BUILD_RELEASE=${BUILD_RELEASE:-/etc/build_release}
printf "%s %s\n" "Build Date:" "`date`" >> "$BUILD_RELEASE"
#printf "%-30s %s\n" "Build Date:" "`date`" >> "$BUILD_RELEASE"
#sort -t ":" -k1 -u "$BUILD_RELEASE" > $BUILD_RELEASE.tmp
#grep "^Build Date:" "$BUILD_RELEASE".tmp > "$BUILD_RELEASE".tmp2 &&
#grep "^Base Build Revision:" "$BUILD_RELEASE".tmp >> "$BUILD_RELEASE".tmp2 &&
#grep -v -e "^Build Date:" -e "^Base Build Revision:" "$BUILD_RELEASE".tmp | sort -u >> "$BUILD_RELEASE".tmp2 &&
#mv -f "$BUILD_RELEASE".tmp2 "$BUILD_RELEASE" && rm -f "$BUILD_RELEASE".tmp
# =============================
# Import my SSH key from GitHub
# not present, works on ubuntu but not fedora
#ssh-import-id gh:harisekhon
authorized_keys="/root/.ssh/authorized_keys"
mkdir -pv "${authorized_keys%/*}"
touch "$authorized_keys"
chmod 0600 "$authorized_keys"
# add other admins public github users here
for user in harisekhon; do
echo "Fetching SSH public keys for user '$user' from GitHub" >&2
curl -sS --fail "https://github.com/$user.keys" |
sed "s|$| github.com/$user|"
done >> "$authorized_keys"
# =============================
# disable Ctrl-Alt-Del reboot behaviour on servers
sed -i 's/^ca:/#ca:/' /etc/inittab
%end