Search code examples
centosrhel

How to use variables in kickstart file for RHEL installation


I would like to use an environment variable in a kickstarter file as in this example:

NFS_KICKSTART=12.23.12.23:12222
nfs --server=$NFS_KICKSTART --dir=/kickstart/

# do some post processing
mount -o nolock $NFS_KICKSTART:/kickstart/ /mnt/temp

Apparently the variables does not get expanded. How can I expand the variable to be used inside the kickstart file?


Solution

  • I found the answer on stackexchange.First create a file in the %pre section and write that to /tmp. In there you can use environment variables as mentioned in the question.

    Then use %include to include this file in the kickstarter file wherever required.