eula --agreed
auth --useshadow --enablemd5
bootloader --location=mbr
clearpart --all --initlabel
text
firewall --disabled
firstboot --disable
keyboard us
lang en_US
reboot --eject
rootpw --plaintext abc123
selinux --disabled
skipx
timezone --utc America/Chicago
install
zerombr
part /boot --fstype ext3 --size=1024 --ondisk=sda
part pv.01 --size=1 --grow --ondisk=sda
volgroup sysvg --pesize=65536 pv.01
logvol swap --fstype swap --name=swap --vgname=sysvg --size=8192
logvol /opt --fstype ext4 --name=opt --vgname=sysvg --size=6144
logvol / --fstype ext4 --name=root --vgname=sysvg --size=10240
logvol /home --fstype ext4 --name=home --vgname=sysvg --size=1024
logvol /tmp --fstype ext4 --name=tmp --vgname=sysvg --size=2048
logvol /var --fstype ext4 --name=var --vgname=sysvg --size=8192
# Using "new" style networking config, by matching networking information to the physical interface's
# MAC-address
%include /tmp/pre_install_network_config
%pre
set -x -v
exec 1>/tmp/ks-pre.log 2>&1
# Once root's homedir is there, copy over the log.
while : ; do
sleep 10
if [ -d /mnt/sysimage/root ]; then
cp /tmp/ks-pre.log /mnt/sysimage/root/
logger "Copied %pre section log to system"
break
fi
done &
# Start pre_install_network_config generated code
# generic functions to be used later for discovering NICs
mac_exists() {
[ -z "$1" ] && return 1
if which ip 2>/dev/null >/dev/null; then
ip -o link | grep -i "$1" 2>/dev/null >/dev/null
return $?
elif which esxcfg-nics 2>/dev/null >/dev/null; then
esxcfg-nics -l | grep -i "$1" 2>/dev/null >/dev/null
return $?
else
ifconfig -a | grep -i "$1" 2>/dev/null >/dev/null
return $?
fi
}
get_ifname() {
if which ip 2>/dev/null >/dev/null; then
IFNAME=$(ip -o link | grep -i "$1" | sed -e 's/^[0-9]*: //' -e 's/:.*//')
elif which esxcfg-nics 2>/dev/null >/dev/null; then
IFNAME=$(esxcfg-nics -l | grep -i "$1" | cut -d " " -f 1)
else
IFNAME=$(ifconfig -a | grep -i "$1" | cut -d " " -f 1)
if [ -z $IFNAME ]; then
IFNAME=$(ifconfig -a | grep -i -B 2 "$1" | sed -n '/flags/s/:.*$//p')
fi
fi
}
# Start of code to match cobbler system interfaces to physical interfaces by their mac addresses
# Start eth0
# Configuring eth0 (08:00:27:1E:29:B0)
if mac_exists 08:00:27:1E:29:B0
then
get_ifname 08:00:27:1E:29:B0
echo "network --device=$IFNAME --bootproto=static --ip=10.32.40.41 --netmask=255.255.255.0 --gateway=10.32.40.1 --nameserver=10.32.8.53" >> /tmp/pre_install_network_config
fi
# End pre_install_network_config generated code
%end
%packages
@core
%end
%post
set -x -v
exec 1>/root/ks-post.log 2>&1
# Start post_install_network_config generated code
# create a working directory for interface scripts
mkdir /etc/sysconfig/network-scripts/cobbler
cp /etc/sysconfig/network-scripts/ifcfg-lo /etc/sysconfig/network-scripts/cobbler/
# set the gateway in the network configuration file
grep -v GATEWAY /etc/sysconfig/network > /etc/sysconfig/network.cobbler
echo "GATEWAY=10.32.40.1" >> /etc/sysconfig/network.cobbler
rm -f /etc/sysconfig/network
mv /etc/sysconfig/network.cobbler /etc/sysconfig/network
# Start configuration for eth0
echo "DEVICE=eth0" > /etc/sysconfig/network-scripts/cobbler/ifcfg-eth0
echo "ONBOOT=yes" >> /etc/sysconfig/network-scripts/cobbler/ifcfg-eth0
echo "HWADDR=08:00:27:1E:29:B0" >> /etc/sysconfig/network-scripts/cobbler/ifcfg-eth0
IFNAME=$(ip -o link | grep -i '08:00:27:1E:29:B0' | sed -e 's/^[0-9]*: //' -e 's/:.*//')
if [ -f "/etc/modprobe.conf" ] && [ $IFNAME ]; then
grep $IFNAME /etc/modprobe.conf | sed "s/$IFNAME/eth0/" >> /etc/modprobe.conf.cobbler
grep -v $IFNAME /etc/modprobe.conf >> /etc/modprobe.conf.new
rm -f /etc/modprobe.conf
mv /etc/modprobe.conf.new /etc/modprobe.conf
fi
echo "TYPE=Ethernet" >> /etc/sysconfig/network-scripts/cobbler/ifcfg-eth0
echo "BOOTPROTO=none" >> /etc/sysconfig/network-scripts/cobbler/ifcfg-eth0
echo "IPADDR=10.32.40.41" >> /etc/sysconfig/network-scripts/cobbler/ifcfg-eth0
echo "NETMASK=255.255.255.0" >> /etc/sysconfig/network-scripts/cobbler/ifcfg-eth0
echo "DNS1=10.32.8.53" >> /etc/sysconfig/network-scripts/cobbler/ifcfg-eth0
# End configuration for eth0
sed -i -e "/^search /d" /etc/resolv.conf
echo -n "search " >>/etc/resolv.conf
echo "" >>/etc/resolv.conf
sed -i -e "/^nameserver /d" /etc/resolv.conf
echo "nameserver 10.32.8.53" >>/etc/resolv.conf
sed -i 's/ONBOOT=yes/ONBOOT=no/g' /etc/sysconfig/network-scripts/ifcfg-eth*
rm -f /etc/sysconfig/network-scripts/ifcfg-eth0
mv /etc/sysconfig/network-scripts/cobbler/* /etc/sysconfig/network-scripts/
rm -r /etc/sysconfig/network-scripts/cobbler
echo "options bonding max_bonds=0" >> /etc/modprobe.d/bonding.conf
cat /etc/modprobe.d/bonding.conf.cobbler >> /etc/modprobe.d/bonding.conf
rm -f /etc/modprobe.d/bonding.conf.cobbler
# End post_install_network_config generated code
# start puppet registration
# end puppet registration
# Start download cobbler managed config files (if applicable)
# End download cobbler managed config files (if applicable)
# Start koan environment setup
# End koan environment setup
# begin Red Hat management server registration
# not configured to register to any Red Hat management server (ok)
# end Red Hat management server registration
# Begin cobbler registration
# skipping for system-based installation
# End cobbler registration
# Enable post-install boot notification
# Start final steps
# End final steps
%end