mrc0mmand / centos / kickstarts

Forked from centos/kickstarts 2 years ago
Clone

Blame CentOS-8-EC2.ks

Brian Stinson dfa83b
text
613101
auth --enableshadow --passalgo=sha512
Brian Stinson dfa83b
shutdown
613101
firewall --enabled --service=ssh
613101
firstboot --disable
613101
keyboard us
613101
# System language
613101
lang en_US.UTF-8
613101
# Network information
613101
network  --bootproto=dhcp --device=link --activate --onboot=on
613101
network  --hostname=localhost.localdomain
613101
# Root password
613101
rootpw --iscrypted thereisnopasswordanditslocked
613101
selinux --enforcing
613101
services --disabled="kdump" --enabled="NetworkManager,sshd,rsyslog,chronyd,cloud-init,cloud-init-local,cloud-config,cloud-final,rngd"
613101
timezone UTC --isUtc
613101
# Disk
613101
bootloader --append="console=ttyS0,115200n8 no_timer_check crashkernel=auto net.ifnames=0 nvme_core.io_timeout=4294967295 nvme_core.max_retries=10" --location=mbr --timeout=1 --boot-drive=vda 
613101
zerombr
613101
clearpart --all --initlabel 
613101
reqpart
083d49
part / --fstype="xfs" --ondisk=vda --size=7950
153a34
153a34
%pre --erroronfail
153a34
/usr/sbin/parted -s /dev/vda mklabel gpt
153a34
%end
613101
613101
%post --erroronfail
613101
passwd -d root
613101
passwd -l root
613101
613101
# pvgrub support
613101
echo -n "Creating grub.conf for pvgrub"
613101
rootuuid=$( awk '$2=="/" { print $1 };'  /etc/fstab )
613101
mkdir /boot/grub
613101
echo -e 'default=0\ntimeout=0\n\n' > /boot/grub/grub.conf
613101
for kv in $( ls -1v /boot/vmlinuz* |grep -v rescue |sed s/.*vmlinuz-//  ); do
613101
  echo "title CentOS Linux 8 ($kv)" >> /boot/grub/grub.conf
613101
  echo -e "\troot (hd0)" >> /boot/grub/grub.conf
613101
  echo -e "\tkernel /boot/vmlinuz-$kv ro root=$rootuuid console=hvc0 LANG=en_US.UTF-8" >> /boot/grub/grub.conf
613101
  echo -e "\tinitrd /boot/initramfs-$kv.img" >> /boot/grub/grub.conf
613101
  echo
613101
done
613101
ln -sf grub.conf /boot/grub/menu.lst
613101
ln -sf /boot/grub/grub.conf /etc/grub.conf
613101
613101
# setup systemd to boot to the right runlevel
613101
rm -f /etc/systemd/system/default.target
613101
ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
613101
echo .
613101
Brian Stinson 8f780b
dnf -C -y remove linux-firmware
613101
613101
# Remove firewalld; it is required to be present for install/image building.
613101
# but we dont ship it in cloud
Brian Stinson 8f780b
dnf -C -y remove firewalld --setopt="clean_requirements_on_remove=1"
Brian Stinson 8f780b
dnf -C -y remove avahi\* 
613101
sed -i '/^#NAutoVTs=.*/ a\
613101
NAutoVTs=0' /etc/systemd/logind.conf
613101
613101
cat > /etc/sysconfig/network << EOF
613101
NETWORKING=yes
613101
NOZEROCONF=yes
613101
EOF
613101
613101
# For cloud images, 'eth0' _is_ the predictable device name, since
613101
# we don't want to be tied to specific virtual (!) hardware
613101
rm -f /etc/udev/rules.d/70*
613101
ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules
613101
613101
# simple eth0 config, again not hard-coded to the build hardware
613101
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF
613101
DEVICE="eth0"
613101
BOOTPROTO="dhcp"
613101
ONBOOT="yes"
613101
TYPE="Ethernet"
613101
USERCTL="yes"
613101
PEERDNS="yes"
613101
IPV6INIT="no"
613101
PERSISTENT_DHCLIENT="1"
613101
EOF
613101
613101
echo "virtual-guest" > /etc/tuned/active_profile
613101
613101
# generic localhost names
613101
cat > /etc/hosts << EOF
613101
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
613101
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
613101
613101
EOF
613101
echo .
613101
613101
systemctl mask tmp.mount
613101
613101
cat <<EOL > /etc/sysconfig/kernel
613101
# UPDATEDEFAULT specifies if new-kernel-pkg should make
613101
# new kernels the default
613101
UPDATEDEFAULT=yes
613101
613101
# DEFAULTKERNEL specifies the default kernel package type
613101
DEFAULTKERNEL=kernel
613101
EOL
613101
613101
# make sure firstboot doesn't start
613101
echo "RUN_FIRSTBOOT=NO" > /etc/sysconfig/firstboot
613101
c01513
# centos cloud user
c01513
echo -e 'centos\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
c01513
sed -i 's/name: cloud-user/name: centos/g' /etc/cloud/cloud.cfg
613101
613101
dnf clean all
613101
613101
# XXX instance type markers - MUST match CentOS Infra expectation
Brian Stinson dfa83b
echo 'ec2' > /etc/yum/vars/infra
613101
f9d28a
# change dhcp client retry/timeouts to resolve #6866
613101
cat  >> /etc/dhcp/dhclient.conf << EOF
613101
613101
timeout 300;
613101
retry 60;
613101
EOF
613101
613101
613101
rm -rf /var/log/yum.log
613101
rm -rf /var/lib/yum/*
613101
rm -rf /root/install.log
613101
rm -rf /root/install.log.syslog
613101
rm -rf /root/anaconda-ks.cfg
613101
rm -rf /var/log/anaconda*
613101
613101
rm -f /var/lib/systemd/random-seed
613101
613101
cat /dev/null > /etc/machine-id
613101
613101
echo "Fixing SELinux contexts."
613101
touch /var/log/cron
613101
touch /var/log/boot.log
613101
mkdir -p /var/cache/yum
613101
/usr/sbin/fixfiles -R -a restore
613101
153a34
# remove these for ec2 debugging
153a34
sed -i -e 's/ rhgb quiet//' /boot/grub/grub.conf
153a34
153a34
cat > /etc/modprobe.d/blacklist-nouveau.conf << EOL
153a34
blacklist nouveau
153a34
EOL
153a34
153a34
# enable resizing on copied AMIs
153a34
echo 'install_items+=" sgdisk "' > /etc/dracut.conf.d/sgdisk.conf
153a34
153a34
echo 'add_drivers+="xen-netfront xen-blkfront "' > /etc/dracut.conf.d/xen.conf
153a34
# Rerun dracut for the installed kernel (not the running kernel):
153a34
KERNEL_VERSION=$(rpm -q kernel --qf '%{V}-%{R}.%{arch}\n')
153a34
dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION
153a34
153a34
613101
# reorder console entries
613101
sed -i 's/console=tty0/console=tty0 console=ttyS0,115200n8/' /boot/grub2/grub.cfg
613101
Brian Stinson 8f1e75
true
Brian Stinson 8f1e75
613101
%end
613101
613101
%packages
613101
@core
613101
chrony
613101
dnf
613101
yum
613101
cloud-init
613101
cloud-utils-growpart
613101
NetworkManager
613101
dracut-config-generic
613101
dracut-norescue
613101
firewalld
d3bcf0
gdisk
613101
grub2
613101
kernel
613101
nfs-utils
613101
rsync
613101
tar
613101
dnf-utils
Brian Stinson 8f1e75
yum-utils
613101
-aic94xx-firmware
613101
-alsa-firmware
613101
-alsa-lib
613101
-alsa-tools-firmware
613101
-ivtv-firmware
613101
-iwl100-firmware
613101
-iwl1000-firmware
613101
-iwl105-firmware
613101
-iwl135-firmware
613101
-iwl2000-firmware
613101
-iwl2030-firmware
613101
-iwl3160-firmware
613101
-iwl3945-firmware
613101
-iwl4965-firmware
613101
-iwl5000-firmware
613101
-iwl5150-firmware
613101
-iwl6000-firmware
613101
-iwl6000g2a-firmware
613101
-iwl6000g2b-firmware
613101
-iwl6050-firmware
613101
-iwl7260-firmware
613101
-libertas-sd8686-firmware
613101
-libertas-sd8787-firmware
613101
-libertas-usb8388-firmware
613101
-biosdevname
613101
-iprutils
613101
-plymouth
613101
613101
python3-jsonschema
613101
qemu-guest-agent
613101
dhcp-client
613101
cockpit-ws
613101
cockpit-system
613101
-langpacks-*
613101
-langpacks-en
613101
613101
centos-release
613101
rng-tools
613101
%end