RedHat Kickstart question
Ulf Zimmermann
ulf at Alameda.net
Thu Apr 17 17:08:25 PDT 2003
On Thu, Apr 17, 2003 at 02:06:22PM -0700, Heather Stern wrote:
> On Wed, Apr 16, 2003 at 04:34:53PM -0700, Ulf Zimmermann wrote:
> > Hello everyone.
> >
> > I got a question someone probably has an answer for on this list.
> > Working on automating system installs. Everything on these machines
> > is the same, with the exception of 2 things. IP address and hostname.
> >
> > Machines get static IP assigned via DHCP. Can I find out, like in the
> > %pre section or so, what the IP is, so that I can use it in this line:
> >
> > #Use static networking
> > network --bootproto static --ip 10.200.1.51 --netmask 255.255.255.0 --gatewa...
> >
> > And the other section is in %post, where based on the hostname I
> > would like to copy a different set of files over, simular like this:
> >
> > if [-f /mnt/tmpmnt/ssh/$HOST/ssh_host_dsa_key]; then
> > /bin/cp /mnt/tmpmnt/ssh/$HOST/* /etc/ssh
> > fi
> >
> > Any tips ?
>
> Re: IP address.
> Ask the proc filesystem? I think it's mounted by then.
>
> Re: %post section
> JimD normally had it do a retrieval from the dhcp server itself (you can
> use the first resolver too; either way, these are something you get
> handed and therefore can parse back out of the running config quickly)
> which allowed him to have it honor custom URLs with extra bits. The
> glorious thing is that it moves the sysadmin controls back to the server
> where it belongs instead of floating around on a scraggable floppy and
> falling out of date.
>
> You could also set the thing up to serve kickstart via PXE - JimD was
> demonstrating that at December's BayLISA.
I am using PXE. I ended up doing the ks.cfg to have dynamic for the
network config (although the DHCP server has a fixed IP for any host).
Then I got a perl script at the end of the %post section, which calls
ifconfig eth0 and netstat -rn and grabs the IP, Netmask, Broadcast
and GW. It then takes these and creates a new /etc/sysconfig/network-scripts/ifcfg-eth0
and adds the GW to /etc/sysconfig/network.
It also allows me to reverse lookup the IP (resolv.conf is configured)
and uses the hostname from reverse DNS to copy fitting SSH host keys in
place (which get saved if I reload a machine). Have now done 6 machines
all from the same ks.cfg, only thing different is the IP and hostname
via DHCP.
--
Regards, Ulf.
---------------------------------------------------------------------
Ulf Zimmermann, 1525 Pacific Ave., Alameda, CA-94501, #: 510-865-0204
You can find my resume at: http://seven.Alameda.net/~ulf/resume.html
More information about the Baylisa
mailing list