Hi Korstiaan,
I think it is simple!
define your variable and create a file variable you can later call
tar the variable file on the persistent directory /vmfs/volumes/datastore1/
untar this file and call it
I change today my kickstart file to achieve this goal and it's work well:
# ###################### Example #########################
%pre
DNS1=$(echo "my first dns ip") # 1st DNS Server
DNS2=$(echo "my second dns ip") # 2nd DNS Server
HOSTNAME=$(echo "my.server.mydomain.ch") # Server Name
NTPSTICKER=$(echo "my.ntp.ch") # ntp server
# #################### /tmp/yourfile ########################
# Send all Variables in a file for use with firstboot section
echo DNS1="${DNS1}" >> /tmp/yourfile
echo DNS2="${DNS2}" >> /tmp/yourfile
echo HOSTNAME="${HOSTNAME}" >> /tmp/yourfile
%post --interpreter=busybox
# copy file / tar dir / cp tgz to a persistent datastore /vmfs/volumes/datastore1/
# after reboot the file stay in this place
cp /tmp/yourfile /YourDirectory/yourfile
tar -czvf YourTGZ.tgz -C / YourDirectory/
chmod 755 YourTGZ.tgz
cp YourTGZ.tgz /vmfs/volumes/datastore1/YourTGZ.tgz
%firstboot --interpreter=busybox
# you untar YourTGZ and use in your fallowing scripts
tar -xzvf /vmfs/volumes/datastore1/YourTGZ.tgz
# you can delete yourtgz if you want or copy somewhere to keep it as archive
rm -f /vmfs/volumes/datastore1/YourTGZ.tgz
# you can call Your file in your script in this way, take care to the space between the dot and the slash
. /Yourfile
########################################################
Best Regards
Denis