Define Variables in command section of RHEL kickstart script?
How would i declare a variable in the command section of my rhel kickstart script? I think this section is interpreted by Python? I tried myVar=variable, myVar="variable" and neither is recognized. Is this even possible?
My goal was to be able to %include a config file that would contain items such as timezone and ip address and then just say
timezone --utc myTimezone
that way an admin would just set the variables in the config file and run the kickstart.
So instead of creating a variable myTimezone, i just included timezone --utc CST in my configuration file. Then when it is included everything is there and works fine. Then they will just modify the config file timezone and it will get implemented when they run the kickstart. Not exactly the solution i wanted but it works fine.
When you wget a file in the %pre section and then %include it in the command section, its as if the text in your included file is inserted in the command section.
I had two problems.
1) my wget command in pre i was using a lowercase -o. It must be upper case -O.
2) In the beginning of my %post section you have to copy your config file from the tmp partition in your preinstalled environment to your tmp directory of your installed image. In my case i have two post sections. The first is nochroot which is why i had to include /mnt
cp /tmp/myConfigFile.cfg /mnt/sysimage/tmp/myConfigFile.cfg
Here is an example of me splitting myConfigFile.cfg into two files. One for variables need in command and the other for variables needed in post.
You will need these commands in the pre section to actually do them and in post to write log files
sed -n /timezone*/p /tmp/myConfigFile.cfg >> /tmp/commandVariables.cfg
sed -n /ntpServer*/p /tmp/myConfigFile.cfg >> /tmp/postVariables.cfg
|All times are GMT -5. The time now is 11:19 PM.|