Skip to content

Instantly share code, notes, and snippets.

@stephdl
Created January 30, 2017 22:13
Show Gist options
  • Save stephdl/9c64c14fde881d9eb0cf69592d6752ac to your computer and use it in GitHub Desktop.
Save stephdl/9c64c14fde881d9eb0cf69592d6752ac to your computer and use it in GitHub Desktop.
/root/anaconda-ks.cfg
[root@tutu ~]# cat /root/anaconda-ks.cfg
#platform=86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Use CDROM installation media
cdrom
# Use graphical install
graphical
firstboot --disable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='fr'
# System language
lang en_US.UTF-8
# Installation logging level
logging --level=debug
# Network information
network --bootproto=static --device=eth0 --gateway=192.168.12.1 --ip=192.168.12.71 --nameserver=8.8.8.8 --netmask=255.255.255.0 --ipv6=auto --activate
network --hostname=tutu.tutu.com
# Reboot after installation
reboot --eject
# Root password
rootpw --iscrypted $6$0K4sM970SSj3lJ1C$NRYCXQvEAWd0gAwyfm0SzgusluMjsoB0KPWDKSJ8kGetyMzVKW8TVeBKETMIbdY9xFH4soPcP8WRTnj82k0Wc1
# SELinux configuration
selinux --permissive
# System services
services --disabled="chronyd"
# Do not configure the X Window System
skipx
# System timezone
timezone Europe/Paris --nontp
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
reqpart --add-boot
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all
# Disk partitioning information
part pv.99 --asprimary --fstype="lvmpv" --ondisk=sda --size=31743
part /boot --fstype="xfs" --size=1024
volgroup VolGroup --pesize=4096 pv.99
logvol / --fstype="xfs" --grow --size=5000 --name=lv_root --vgname=VolGroup
logvol swap --fstype="swap" --size=2048 --name=lv_swap --vgname=VolGroup
%pre
# eval options
set -- `cat /proc/cmdline`
for I in $*; do case "$I" in *=*) eval $I;; esac; done
# Determine how many drives we have
if [ -z "$disks" ]; then
disks=()
tmp=( $(list-harddrives | cut -d' ' -f 1) )
for d in "${tmp[@]}"
do
if [[ $d == md* ]]; then
# skip md raid devices
continue
fi
mount | grep -q /dev/$d
if [ $? -gt 0 ]; then
disks+=($d)
fi
done
numd=${#disks[@]}
d1=${disks[0]}
d2=${disks[1]}
else
d1=`echo $disks | awk 'BEGIN { FS = "," } ; { print $1 }'`
d2=`echo $disks | awk 'BEGIN { FS = "," } ; { print $2 }'`
if [ -z "$d2" ]; then
numd=1
else
numd=2
fi
fi
if [ $numd -lt 2 ] || [ $raid = "none" ] ; then
cat <<EOF >> /tmp/part-include
# 1 disk, no raid
part /boot --fstype xfs --size 1024
part pv.1 --asprimary --fstype='physical volume (LVM)' --ondisk=$d1 --size=5000 --grow
EOF
echo "bootloader --location=mbr " > /tmp/bootloader-include
elif [ $numd -ge 2 ]; then
cat <<EOF >> /tmp/part-include
# 2 disks, raid 1
part raid.00 --asprimary --fstype='raid' --ondisk=$d1 --size=1024 # boot
part raid.01 --asprimary --fstype='raid' --ondisk=$d1 --size=5000 --grow# root
part raid.10 --asprimary --fstype='raid' --ondisk=$d2 --size=1024 # boot
part raid.11 --asprimary --fstype='raid' --ondisk=$d2 --size=5000 --grow# root
raid /boot --device=md1 --fstype='xfs' --level=1 raid.00 raid.10
raid pv.1 --device=md2 --fstype='physical volume (LVM)' --level=1 raid.01 raid.11
EOF
echo "bootloader --location=mbr " > /tmp/bootloader-include
fi
# enable dhcp on all network interfaces
for net in `find /sys/class/net/ -mindepth 1 ! -name lo | cut -d '/' -f5`; do
echo "network --onboot=yes --bootproto=dhcp --device=$net" --nameserver=8.8.8.8 >>/tmp/network-include
done
# set encrypted fs
if [ -z $fspassword ]; then
echo "logvol / --fstype xfs --name=lv_root --vgname=VolGroup --size=5000 --grow" > /tmp/rootfs-include
else
echo "logvol / --fstype xfs --name=lv_root --vgname=VolGroup --size=5000 --grow --encrypted --passphrase=$fspassword" > /tmp/rootfs-include
fi
%end
%post --interpreter=/bin/bash
exec 1>/root/kickstart-post.log 2>&1
echo "Enabling first-boot..."
touch /var/spool/first-boot
echo "Importing RPM GPG keys..."
rpm --import /etc/pki/rpm-gpg/*
echo "Enable nethserver units..."
systemctl enable nethserver-system-init
systemctl enable nethserver-config-network
systemctl disable NetworkManager
echo "Disable kdump..."
systemctl disable kdump
%end
%packages
@core
@nethserver-iso
kexec-tools
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment