[Spacewalk-list] Spacewalk Kickstart wizard variables

Corey Hemminger corey.hemminger at nativex.com
Thu Jun 6 19:11:12 UTC 2013


I have a pre script for kickstart that I'd like to set variables for cobbler templating of the scripts that are based on user input and can also be used in the post scripts for things like hostname and networking. Here is a copy of the script below. How can I set a variable in the pre script that can be called and used in the post script. I've learned that the "kickstart details > variables" Aren't editable during the kickstart process. 

This is for a bare metal install and I want to be able to get a few inputs at the beginning then run unattended. I did originally have all this in the post install but then the install doesn't finish if someone walks away until they come back and add the inputs and the script continues with the final configuration and post install update. 

curTTY=`tty`
exec < \$curTTY > \$curTTY 2> \$curTTY

echo
echo -n "Starting Pre Install Script"

echo
echo -n "Configure the Server"
while [ x"$answer" != "xy" ] && [ x"$answer" != "xY" ]; do
        echo
        echo -n "enter hostname: "; read hostname2
        echo -n "enter ip adress: "; read ip
        echo -n "enter netmask: "; read netmask
        echo -n "enter default gateway: "; read gw
        echo -n "enter domain name to join pc to ie. example.com: "; read domain
        echo -n "enter user account to join domain: "; read user
        echo -n "enter user password to join domain: "; read pass
        echo -n "enter token number for cassandra node, leave blank to allow auto bisect of most loaded token range during autobootstrap: "; read token
        echo -n "enter datacenter for cassandra node location: "; read dc
        echo -n "enter rack for cassandra node location: "; read rack
        echo

        echo You entered:
        echo -e "\thostname:            $hostname2"
        echo -e "\tip address:          $ip"
        echo -e "\tnetmask:             $netmask"
        echo -e "\tdefault gateway:     $gw"
        echo -e "\tdomain:              $domain"
        echo -e "\tAD account:          $user"
        echo -e "\tAD password:         $pass"
        echo -e "\tcassandra token:     $token"
        echo -e "\tcassandra DC:        $dc"
        echo -e "\tcassandra rack:      $rack"
        echo
        echo -n "Double check passwords are correct or else Domain join will fail and will be required to be done manually after reboot"
        echo
        echo -n "Is this correct? [y/n] "; read answer
done

echo
echo -n "Setting Host Name."

echo "network --device eth0 --bootproto static \
       --ip=${ip} --netmask=${netmask} \
       --gateway=${gw} \
       --hostname=${hostname2} \
       --onboot=yes --noipv6 \
       --nameserver=${dns1}" > /tmp/network


Thanks,
Corey





More information about the Spacewalk-list mailing list