summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Abdo2019-10-09 12:11:01 +0200
committerThiago Abdo2019-10-09 12:17:11 +0200
commit3ae1d05e367fc6d075c5bd1f629017dea1dab884 (patch)
tree79395f9f7ab1c962940f75882f8b0b1ed9d577f3
parentAdd centos-8 json file, copied and ajusted from centos-7 (diff)
downloadpacker-templates-3ae1d05e367fc6d075c5bd1f629017dea1dab884.tar.gz
packer-templates-3ae1d05e367fc6d075c5bd1f629017dea1dab884.tar.xz
packer-templates-3ae1d05e367fc6d075c5bd1f629017dea1dab884.zip
Add centos-8 kickstart, inside of kickstart link to deprecated functions
Signed-off-by: Thiago Abdo <tjabdo@inf.ufpr.br>
-rw-r--r--http/centos-8/anaconda-ks.cfg51
1 files changed, 51 insertions, 0 deletions
diff --git a/http/centos-8/anaconda-ks.cfg b/http/centos-8/anaconda-ks.cfg
new file mode 100644
index 0000000..236870a
--- /dev/null
+++ b/http/centos-8/anaconda-ks.cfg
@@ -0,0 +1,51 @@
+
+#Deprecated functions since centOs 7
+#https://docs.centos.org/en-US/8-docs/advanced-install/assembly_kickstart-commands-and-options-reference/#kickstart-changes_kickstart-commands-and-options-reference
+
+text
+reboot
+url --mirrorlist=http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=baseos
+lang en_US.UTF-8
+keyboard --vckeymap=us --xlayouts='us'
+timezone Europe/Berlin --isUtc --nontp
+clearpart --none --initlabel
+bootloader --location=mbr --boot-drive=sda
+part biosboot --fstype="biosboot" --ondisk=sda --size=1
+part / --fstype="xfs" --ondisk=sda --grow --label=SLX_SYS
+
+%packages
+@^minimal-environment
+%end
+
+# small python script to extract the password from the kernel command line
+# expects the password given as: rootpw=<password>
+%pre --interpreter=/usr/libexec/platform-python
+import shlex, crypt
+arg = 'rootpw='
+with open('/proc/cmdline', 'r') as f:
+ kcl = f.read().split()
+# extract the password
+passwords = [x[len(arg):] for x in kcl if x.startswith(arg)]
+if len(passwords) == 1:
+ kclpass = passwords[0]
+# TODO sane fallbacks. This should work most of the time though :)
+# generate SHA512 hash
+hash = crypt.crypt(kclpass, crypt.mksalt(crypt.METHOD_SHA512))
+with open('/tmp/setup-root-pass', 'w') as f:
+ f.write('rootpw --iscrypted ' + hash)
+%end
+# include the created password file
+%include /tmp/setup-root-pass
+
+%post --erroronfail
+# allow root login for ansible
+sed 's,^[[:blank:]]*#*PermitRootLogin.*,PermitRootLogin yes,g' /etc/ssh/sshd_config
+
+ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules
+cat > /etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF
+DEVICE="eth0"
+BOOTPROTO="dhcp"
+ONBOOT="yes"
+TYPE="Ethernet"
+EOF
+%end