Using variables in kickstart file

Shabazian, Chip Chip.Shabazian at bankofamerica.com
Wed Jul 18 18:15:07 UTC 2007


in the command section, use %include /tmp/network

in the %pre section, you create /tmp/network by reading /proc/cmdline
and getting the settings you need.

I suggest running through it manually to figure it out by putting sleep
9999999 in your %pre, or using a tool designed for this such as cobbler.

-----Original Message-----
From: kickstart-list-bounces at redhat.com
[mailto:kickstart-list-bounces at redhat.com] On Behalf Of Gabrie
Sent: Wednesday, July 18, 2007 10:22 AM
To: Discussion list about Kickstart
Subject: Re: Using variables in kickstart file

Would you have an example of that?

I now set the variables in the %post section and then they are available
in the scripts. But I can't use them in the "network"
section.

Gabrie


On 7/18/07, Shabazian, Chip <Chip.Shabazian at bankofamerica.com> wrote:
> You could also add these variables to the boot: line and then pull 
> them from /proc/cmdline in the %pre section.  Just make sure you have 
> 255 characters or less for that boot: line.
>
> -----Original Message-----
> From: kickstart-list-bounces at redhat.com 
> [mailto:kickstart-list-bounces at redhat.com] On Behalf Of Gabrie
> Sent: Wednesday, July 18, 2007 2:55 AM
> To: Kickstart-list at redhat.com
> Subject: Using variables in kickstart file
>
> Hi
>
> I'm going to install about 20 servers, which will be identical apart 
> from hostname and IP address. To make changes in all ks files easier, 
> I would like to start using one central batch file, that is being 
> called from the ks.cfg file. Therefore I would like to use 2 variables

> containing IP and hostname.
>
> Ideally it would be something like this:
>
> ### Begin ks020.cfg
> VAR-IP = 10.0.0.20
> VAR-HOST = vmesx020.mydomain.com
>
> <snip>
>
> network --device eth0 --bootproto static --ip $VAR-IP --netmask 
> 255.255.255.0 -gateway 10.0.0.254 --hostname $VAR-HOST
>
> <snip>
>
> %post
> # download central script
> lwp-download http://10.0.0.1/scripts/central.cfg /tmp/central.cfg
>
> perl /tmp/central.cfg $VAR-IP $VAR-HOST
>
> ### End ks020.cfg
>
>
> In the central.cfg I would then be able to read the VAR-IP and 
> VAR-HOST and use it for other configuration stuff.
>
> Who can tell me how to use variables in this way? I have the feeling 
> there also is a difference between a variable in the first section 
> (network section) and the post section????
>
> Gabrie
>
> _______________________________________________
> 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




More information about the Kickstart-list mailing list