Skip to content

Instantly share code, notes, and snippets.

@stahnma
Created April 15, 2010 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stahnma/367507 to your computer and use it in GitHub Desktop.
Save stahnma/367507 to your computer and use it in GitHub Desktop.
# MAIN KICKSTART OPTIONS
text
install
# RHEN key (this one is bogus)
key dc3c9f98df0000000
lang en_US.UTF-8
langsupport --default en_US.UTF-8 en_US.UTF-8
keyboard us
mouse genericwheelps/2 --device psaux
skipx
rootpw cobbler
# use mpath
bootloader --location=mbr --driveorder=mapper/mpath0
firewall --disabled
authconfig --enableshadow --enableldap --enableldapauth --ldapserver ldaps.example.com --ldapbasedn dc=example,dc=com
# use mpath again
multipath --name=mpath0 --device=sda --rule=failover
selinux --disabled
timezone --utc America/Chicago
firstboot --disable
network --bootproto dhcp --device eth0
url --url=http://cobbler.example.com:80/cblr/links/RHEL-5.5-x86_64
# Reboot after installation
reboot
# DISK PARTITIONING
clearpart --initlabel --all --drives=mapper/mpath0
part /boot --fstype ext3 --size=100 --ondisk=mapper/mpath0
part pv.100000 --size=100 --grow --ondisk=mapper/mpath0
volgroup rootvg pv.100000
logvol /tmp --fstype ext3 --name=tmp --vgname=rootvg --size=2048
logvol swap --fstype swap --name=swap --vgname=rootvg --size=1024
logvol / --fstype ext3 --name=root --vgname=rootvg --size=5120
logvol /var --fstype ext3 --name=var --vgname=rootvg --size=2048
logvol /opt --fstype ext3 --name=opt --vgname=rootvg --size=1024
logvol /home --fstype ext3 --name=home --vgname=rootvg --size=1024
# PACKAGES AND PACKAGE GROUPS
%packages
# Unable to read /var/lib/cobbler/snippets/CAT_packages
# PRE INSTALLATION TASKS
%pre
wget "http://cobbler.example.com/cblr/svc/op/trig/mode/pre/system/ucshrhel00" -O /dev/null
# POST INSTALLATION CUSTOMIZATIONS
%post
# Change to virtual terminal 3 so we can see the post script output.
chvt 3
wget "http://cobbler.example.com/cblr/svc/op/trig/mode/post/system/ucshrhel00" -O /dev/null
wget "http://cobbler.example.com/cblr/svc/op/nopxe/system/ucshrhel00" -O /dev/null
wget "http://cobbler.example.com/cblr/svc/op/ks/system/ucshrhel00" -O /root/cobbler.ks
cd /tmp
/bin/ln -s /bin/bash /usr/bin/bash
/bin/chmod 1777 /home
# This will auto create home directories.
# It should probably be pushed by cfengine instead of here.
/bin/cat<<EOEPF>>/etc/profile
if [ ! -d \$HOME ]; then
/bin/echo "Hrm... you've never logged in before... creating
\$HOME..."
/bin/mkdir \$HOME;
chmod 750 \$HOME;
/bin/cp /etc/skel/.* \$HOME;
cd \$HOME
fi
EOEPF
/sbin/chkconfig iptables off
# For now, we need the rubies from our custom channels. Excluding from package list doesn't work for some reason.
rpm -e ruby-libs
# Start post_install_network_config generated code
mkdir /etc/sysconfig/network-scripts/cobbler
cp /etc/sysconfig/network-scripts/ifcfg-lo /etc/sysconfig/network-scripts/cobbler/
grep -v GATEWAY /etc/sysconfig/network > /etc/sysconfig/network.cobbler
echo "GATEWAY=192.168.1.1" >> /etc/sysconfig/network.cobbler
rm -f /etc/sysconfig/network
mv /etc/sysconfig/network.cobbler /etc/sysconfig/network
grep -v HOSTNAME /etc/sysconfig/network > /etc/sysconfig/network.cobbler
echo "HOSTNAME=ucsrhel00" >> /etc/sysconfig/network.cobbler
rm -f /etc/sysconfig/network
mv /etc/sysconfig/network.cobbler /etc/sysconfig/network
# Also set the hostname now, some applications require it (e.g.: if we're
# connecting to Puppet before a reboot).
/bin/hostname ucsrhel00
# Start configuration for eth0
IFNAME=$(ifconfig -a | grep -i '00:25:B5:00:00:0E' | cut -d ' ' -f 1)
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 "DEVICE=eth0" > /etc/sysconfig/network-scripts/cobbler/ifcfg-eth0
echo "HWADDR=00:25:B5:00:00:0E" >> /etc/sysconfig/network-scripts/cobbler/ifcfg-eth0
echo "ONBOOT=yes" >> /etc/sysconfig/network-scripts/cobbler/ifcfg-eth0
echo "BOOTPROTO=static" >> /etc/sysconfig/network-scripts/cobbler/ifcfg-eth0
echo "IPADDR=192.168.1.52" >> /etc/sysconfig/network-scripts/cobbler/ifcfg-eth0
echo "NETMASK=255.255.255.0" >> /etc/sysconfig/network-scripts/cobbler/ifcfg-eth0
echo "DNS1=192.168.1.1" >> /etc/sysconfig/network-scripts/cobbler/ifcfg-eth0
echo "DNS2=192.168.1.2" >> /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 -n "example.com " >>/etc/resolv.conf
echo "" >>/etc/resolv.conf
sed -i -e "/^nameserver /d" /etc/resolv.conf
echo "nameserver 192.168.1.1" >>/etc/resolv.conf
echo "nameserver 192.168.1.2" >>/etc/resolv.conf
rm -f /etc/sysconfig/network-scripts/ifcfg-*
mv /etc/sysconfig/network-scripts/cobbler/* /etc/sysconfig/network-scripts/
rm -r /etc/sysconfig/network-scripts/cobbler
if [ -f "/etc/modprobe.conf" ]; then
cat /etc/modprobe.conf.cobbler >> /etc/modprobe.conf
rm -f /etc/modprobe.conf.cobbler
fi
# End post_install_network_config generated code
if [ $EUID -ne 0 ]
then
echo This script must be run as root
exit 1
fi
# Turn off in /etc/sysconfig/network
cat << EONET > /etc/sysconfig/network
NETWORKING_IPV6=no
`grep -iv NETWORKING_IPV6 /etc/sysconfig/network`
EONET
# Determine modprobe.conf/modules.conf
if [ -e /etc/modprobe.conf ]
then
MODFILE=modprobe.conf
# Turn off in /etc/mod[ules/probe].conf
cat << EOMPCONF > /etc/$MODFILE
alias net-pf-10 off
alias ipv6 off
`grep -iv "net-pf-10" /etc/$MODFILE | grep -iv ipv6`
EOMPCONF
fi
if [ -e /etc/modules.conf ]
then
MODFILE=modules.conf
# Turn off in /etc/mod[ules/probe].conf
cat << EOMPCONF > /etc/$MODFILE
alias net-pf-10 off
alias ipv6 off
`grep -iv "net-pf-10" /etc/$MODFILE | grep -iv ipv6`
EOMPCONF
fi
if [ -z $MODFILE ]
then
echo Unable find a module configuration file.
exit 1
fi
#Stop the ipv6tables service
/sbin/service ip6tables stop
# Disable the ipv6tables service
/sbin/chkconfig ip6tables off
# Disable ipv6 localhost address in /etc/hosts
# Edit /etc/hosts
sed -i '/::1/d' /etc/hosts
sleep 5
chvt 1
echo RHEL-5.5-x86_64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment