Satellite 5.7 Kickstart physicals with variable LUN IDs

Latest response

I'm trying to setup our new satellite 5.7 server to be my build server. Currently we create a modified kickstart file for every build, and include the LUN ID on the appropriate part lines:

part /boot --fstype ext4 --size=500 --ondisk=disk/by-id/scsi-3600601602640330000c45806df8ee511

part pv.01 --grow --size=1 --ondisk=disk/by-id/scsi-3600601602640330000c45806df8ee511

What I would like is to have a single kickstart in satellite that prompts for the LUN ID. This is what I tried so far.

In the %pre scripts:

iotty=tty
exec > $iotty 2> $iotty
echo -n "Enter the WWID of the boot LUN: "
read WWID
echo "WWID set to $WWID "
sleep 5
%end

This does successfully ask for the LUN ID.

I then modified the part lines like so:

part /boot --fstype ext4 --size=500 --ondisk=disk/by-id/scsi-$WWID
part pv.01 --grow --size=1 --ondisk=disk/by-id/scsi-$WWID

But it's not taking the WWID and inserting it there, because I'm getting an error saying it can't find the "/disk/by-id/scsi-$WWID". Is what I'm trying to do possible? Am I just going about this incorrectly? I'd love to see how others have solved this issue. All our physical builds are boot-from-san with multipathing, so I've gotta figure out a way to make this work.

Responses

You need to dump the variables from your pre script to a file in /tmp or some other location and then query them from there Anaconda doesn't know about the variables from the pre section during processing of the kickstart

In our case we write out the partition section in %pre to /tmp/partitions and the in the kickstart itself, we say %include /tmp/partitioning

This works fine w/ 6.x , so maybe it'll give you some guidance on 5.x

scsi_id="$(/lib/udev/scsi_id -gud /dev/${DISK})"
tdsk="/dev/disk/by-id/scsi-${scsi_id}"
echo "Primary DISK - $tdsk" 
echo "Generating Partition File"
cat << EOF >> /tmp/partitioning
bootloader --location=mbr --driveorder=${tdsk} --append="crashkernel=auto, biosdevname=0 rhgb quiet"
part /boot --fstype ext4 --size=512 --ondisk=${tdsk} --asprimary
part swap --size 4096 --ondisk=${tdsk}
part pv.4 --size=100 --grow --ondisk=${tdsk}
volgroup rootvg --pesize=32768 pv.4
logvol / --fstype ext4 --name=rootlv --vgname=rootvg --size=4096
EOF

In the partitioning section

%include /tmp/partitioning
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.