On 3/2/2006, "Patrick" <ks@xxxxxxxxxxxxxxxxx> wrote: >Hi all, > >Last time I was on this list was iirc in 2002 so I'm sort of new to the >list. Recently I setup a PXE/kickstart install system for a bunch of >servers. Works very well (pxe/kickstart rocks!) but it is incomplete so >I would like to iron out more details. Once the install is finished I >would like to: > >* add extra firewall rules to /etc/sysconfig/iptables or replace it >* change or replace some configs like /etc/ntp.conf, /etc/hosts >* turn off a ton of unneeded services (chkconfig --level 2345 foo off) >* turn off IPv6 in (iirc) /etc/modules.conf >* turn off zerconf in /etc/sysconfig/network >* install a bunch of updates >* install some extra rpms > >I assume I should specify this in the %post section of the kickstart >file but I don't know what the required syntax is. Any suggestions or >docs how I go about this? > >Thanks and regards, >Patrick > >_______________________________________________ >Kickstart-list mailing list >Kickstart-list@xxxxxxxxxx >https://www.redhat.com/mailman/listinfo/kickstart-list > Hi Patrick, I do most of this type of stuff throuigh a shell script that gets called in %post (you could do it all in %post as well, but I find it easier to maintain a single script that can be called from any of my kickstart configs, or even run standalone). I've found that the easiest way to do things is to just create new files to replace the old, rather than manually inserting things into them. For example, if you wanted to have a certain set of iptables rules on all machines, you could just create the rules file, and keep it on an NFS server, and have your %post grab that file and replace the one in /etc/sysconfig. You can also run interactive commands during post, so it would be possible to write something that would prompt you for input. I use "dialog" for this, but you could use anything. Anyhow, this is how my %post looks: %post #%post --interpreter /bin/sh exec < /dev/tty3 > /dev/tty3 chvt 3 cat <<EOF >>/etc/motd ####################################### ## KICKSTART STILL IN PROGRESS!!!!!! ## ####################################### `cat /etc/redhat-release` - Installed `date` EOF echo " * Mounting our NFS share..." mkdir /mnt/ks mount -r -o nolock 10.1.1.1:/kickstart /mnt/ks echo " * Copying config files from NFS..." cp -a /mnt/ks/linux-postinstall.sh /root/ cp -a /mnt/ks/redhatconfig.tar.gz /root/ # Grab our gdm-conf cp -a /mnt/ks/fedora-gdm.conf /root/ # Import the RHN GPG key rpm --import /usr/share/rhn/RPM-GPG-KEY-fedora # Grab the NVIDIA driver installer in case we need it cp -a /mnt/ks/NVIDIA-Linux-x86-1.0-7676-pkg1.run /root/ # Grab our yum.conf cp -f /mnt/ks/yum.conf /etc/yum.conf # Unmount the share & delete the mount point umount /mnt/ks rm -rf /mnt/ks # Change our motd to a "normal" value rm -f /etc/motd cat <<EOF >>/etc/motd `cat /etc/redhat-release` - Installed `date` EOF # Execute our post install if [ -f /root/linux-postinstall.sh ]; then echo " * Executing Post-Install..." chmod +x /root/linux-postinstall.sh else echo "Can't find linux-postinstall.sh." fi # We done. echo " * Post-Install complete. System rebooting." >>/root/ks.log echo " * Post-Install complete. System rebooting." chvt 3 sleep 10 exit 0 #EOF Hope that helps a bit. -Dan