From 9a02e1e0c28975de3b62405c6a17ca852a6174c2 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Thu, 22 Feb 2018 11:56:53 +0100 Subject: anaconda: common kickstart file for centos-7.3 and centos-7.4 --- http/centos-7.3 | 1 + http/centos-7.3/anaconda-ks.cfg | 55 ----------------------------------------- http/centos-7.4 | 1 + http/centos-7.4/anaconda-ks.cfg | 55 ----------------------------------------- http/centos/anaconda-ks.cfg | 55 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 57 insertions(+), 110 deletions(-) create mode 120000 http/centos-7.3 delete mode 100644 http/centos-7.3/anaconda-ks.cfg create mode 120000 http/centos-7.4 delete mode 100644 http/centos-7.4/anaconda-ks.cfg create mode 100644 http/centos/anaconda-ks.cfg diff --git a/http/centos-7.3 b/http/centos-7.3 new file mode 120000 index 0000000..95e1895 --- /dev/null +++ b/http/centos-7.3 @@ -0,0 +1 @@ +centos \ No newline at end of file diff --git a/http/centos-7.3/anaconda-ks.cfg b/http/centos-7.3/anaconda-ks.cfg deleted file mode 100644 index 1026914..0000000 --- a/http/centos-7.3/anaconda-ks.cfg +++ /dev/null @@ -1,55 +0,0 @@ -install -text -reboot -url --mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os -lang en_US.UTF-8 -keyboard --vckeymap=de-nodeadkeys --xlayouts='de (nodeadkeys)' -timezone Europe/Berlin --isUtc --nontp -auth --enableshadow --passalgo=sha512 -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 -@core -kexec-tools -%end - -# small python script to extract the password from the kernel command line -# expects the password given as: rootpw= -%pre --interpreter=/usr/bin/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 -yum -y update -yum -y install epel-release -yum -y install ansible -yum -y update -# 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 < -%pre --interpreter=/usr/bin/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 -yum -y update -yum -y install epel-release -yum -y install ansible -yum -y update -# 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 < +%pre --interpreter=/usr/bin/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 +yum -y update +yum -y install epel-release +yum -y install ansible +yum -y update +# 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 <