Redhat RHN (re)-joining in Kickstart

Phil Bettinson phb at llgc.org.uk
Thu Mar 30 14:58:51 UTC 2006


Thanks for the help guys.

It seems the final solution looks a little something like this....

HOSTNAME=`grep $IP /kickstart/hosts | awk '{print $3}'`
IP=`ifconfig eth0 | grep inet | awk '{print $2}' | awk -F: '{print $2}'`
HOST=`grep $IP /kickstart/hosts | awk '{print $2}'`
echo "$IP       $HOST   $HOSTNAME" >> /etc/hosts
hostname -v -- "$HOSTNAME"

/kickstart is a directory previously mounted from the NFS server, where 
I have a "host" file, that is a file that is laid out like a hostfile 
(ish), with no comments in. eg

(sample line)
192.168.0.1	mymachine	mymachine.mynetwork.co.uk	10.0.0.1

The last IP address allows me to place the machine on two different 
networks.

Here's the kickstart Stuff

echo "Registring with RHN"

/usr/sbin/rhnreg_ks --activationkey=<insertl long key here>
echo " "
echo "Running up2date"
/usr/sbin/up2date up2date
/usr/sbin/up2date -u

The reason for using an activation key means that they go back into the 
right group at the end of the kickstart (that bit was the important 
bit). the reason for not wanting to use --profile is that that implies 
that there is a profile there already (in our case there might not be)

You may notice that I first up2date up2date, before updating the system, 
that's because in the version of RHAS3 (rh3 no updates) I'm 
kickstarting, it has problems with dependencies on the x64_86 architecture.

I also don't up2date the kernel here because of various (other) system 
dependencies that break on a kernel upgrade without 
modification/recompile/reinstall.  This ensure that the system comes up 
working, and as secure as possible to ensure that we can get working 
straight away.

Admitedly I don't need all this detail here, but it's here for those 
that happen to google this problem in the future.

Thanks for the help solving this problem

Phil Bettinson

James_Martin at ao.uscourts.gov wrote:
> The only way I was able to fix this (and it occurs for me after the 
> install if I tried to register) was this in %post:
> 
> echo "192.168.10.100 myhostname" >> /etc/hosts
> 
> of course make the necessary substitutions, and perform this before you do 
> the rhnreg_ks
> 
> James S. Martin, RHCE
> Contractor
> Administrative Office of the United States Courts
> Washington, DC
> (202) 502-2394
> 
> kickstart-list-bounces at redhat.com wrote on 03/29/2006 12:00:38 PM:
> 
> 
>>I set it in my post like this:
>>
>>export HOSTNAME=`grep HOSTNAME /etc/sysconfig/network | awk -F= '{print
>>$2}'`
>>hostname $HOSTNAME
>>
>>
>>-----Original Message-----
>>From: kickstart-list-bounces at redhat.com
>>[mailto:kickstart-list-bounces at redhat.com] On Behalf Of James P
>>Sent: Wednesday, March 29, 2006 7:48 AM
>>To: Discussion list about Kickstart
>>Subject: Re: Redhat RHN (re)-joining in Kickstart
>>
>>Kinda depends how you're setting your hostname and how your doing your
>>registration during the kickstart, but it should be fairly easy no
>>matter how you approach it. In my own builds, I set the hostname in the
>>%pre section and then register in the %post like this:
>>
>>rhnreg_ks --profilename $HOSTNAME
>>
>>p.s. Not sure if this is what you meant, but you don't really have to
>>re-register the systems just to change their profile names. You can edit
>>that part of the RHN website manually.
>>
>>Philip Rowlands wrote:
>>
>>
>>>On Wed, 29 Mar 2006, Phil Bettinson wrote:
>>>
>>>
>>>>I'm currently arguing with a small part of a kickstart script that 
>>>>joins, and updates the computers to the kickstart network. It works, 
>>>>appart from the fact that it registers them as "localhost.localhost",
>>
>>>>as opposed to their machine names.
>>>>
>>>>The machines have the correct names when they reboot (that is, the 
>>>>pick up the correct hostnames, and have the right ip addresses etc.),
>>
>>>>but it means that I have to re-register them with RHN in order to 
>>>>give them a sane name.
>>>
>>>
>>>I had this as a %post script:
>>>
>>>#!/bin/sh -
>>>. /etc/sysconfig/network
>>>hostname -v -- "$HOSTNAME"
>>>
>>>
>>>which might do the trick.
>>>
>>>
>>>Cheers,
>>>Phil
>>>
>>>_______________________________________________
>>>Kickstart-list mailing list
>>>Kickstart-list at redhat.com
>>>https://www.redhat.com/mailman/listinfo/kickstart-list
>>>
>>
>>_______________________________________________
>>Kickstart-list mailing list
>>Kickstart-list at redhat.com
>>https://www.redhat.com/mailman/listinfo/kickstart-list
>>
>>_______________________________________________
>>Kickstart-list mailing list
>>Kickstart-list at redhat.com
>>https://www.redhat.com/mailman/listinfo/kickstart-list
> 
> 
> _______________________________________________
> Kickstart-list mailing list
> Kickstart-list at redhat.com
> https://www.redhat.com/mailman/listinfo/kickstart-list

-- 
-----------------------------------------------------------------------
			Phil Bettinson

Swyddog Gweinyddu Systemau	Systems Administrator

Isadran Cyfrifiaduron        	Computer Section
Llyfrgell Genedlaethol Cymru    National Library of Wales
Aberystwyth, 			Aberystwyth
Ceredigion, 			Ceredigion
SY23 3BU			SY23 3BU

Ffôn / Phone: 01970 632867    	Ffacs / Fax: 01970 615709
EBost / Email: phb AT NOSPAM llgc.org.uk  We / Web: http://www.llgc.org.uk
-----------------------------------------------------------------------
Yn siarad drosof fy hun, nid LlGC   -  Speaking personally, not for NLW




More information about the Kickstart-list mailing list