Last active
September 30, 2019 16:44
-
-
Save sierra-tango-echo/68fa654a4baffcaa36e0b46812faa9fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
DISTRO=centos7 | |
INSTALLKERNELURL=https://mirror.bytemark.co.uk/centos/7/os/x86_64/images/pxeboot/vmlinuz | |
INSTALLINITRDURL=https://mirror.bytemark.co.uk/centos/7/os/x86_64/images/pxeboot/initrd.img | |
INSTALLURL=https://mirror.bytemark.co.uk/centos/7/os/x86_64/ | |
DEPLOYMENTDIR=/opt/flight/deployment/kickstart/${DISTRO} | |
HTTPDIR=deployment/kickstart/${DISTRO} | |
PXEBOOT=/var/lib/tftpboot/boot/ | |
PXEDEFAULT=/var/lib/tftpboot/pxelinux.cfg/default | |
KICKSTARTFILE=${DEPLOYMENTDIR}/basic.ks | |
if ! [ -d ${DEPLOYMENTDIR} ]; then | |
mkdir -p ${DEPLOYMENTDIR} | |
else | |
echo "A Kickstart based deployment by the name of '${DISTRO}' already exists" >&2 | |
exit 1 | |
fi | |
echo "Downloading env files.." | |
curl ${INSTALLKERNELURL} > ${PXEBOOT}/kernel-${DISTRO} | |
curl ${INSTALLINITRDURL} > ${PXEBOOT}/initrd-${DISTRO} | |
echo "Installing generic kickstart.." | |
cat << EOF > ${KICKSTARTFILE} | |
#MISC | |
text | |
reboot | |
skipx | |
install | |
#SECURITY | |
firewall --enabled | |
firstboot --disable | |
selinux --disabled | |
#AUTH | |
auth --useshadow --enablemd5 | |
rootpw 0p3nflight | |
#LOCALIZATION | |
keyboard uk | |
lang en_GB | |
timezone Europe/London | |
#REPOS | |
url --url=${INSTALLURL} | |
#DISK | |
clearpart --all --initlabel | |
autopart --nohome | |
#PACKAGES | |
%packages --ignoremissing | |
@base | |
@Core | |
%end | |
EOF | |
echo "Adding entry to pxedefault" | |
cat << EOF >> ${PXEDEFAULT} | |
LABEL flightkickstart-${DISTRO} | |
MENU LABEL flightkickstart-${DISTRO} | |
KERNEL boot/kernel-${DISTRO} | |
APPEND initrd=boot/initrd-${DISTRO} ks=http://10.10.0.1/${HTTPDIR}/basic.ks network ks.sendmac inst.syslog=10.10.0.1 inst.loglevel=debug console=ttyS1,115200n8 console=tty0 | |
IPAPPEND 2 | |
EOF | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment