So I'm using a kscfg with pxe/kickstart to lay down the ESXi host configuration for provisioning. Due to the way our provisioning system works we would like to send a message back to the kickstart server informing that the server has been provisioned(kickstarted)
I don't see a way to do this because the kscfg scirpt does everything all at once, lays down the image and configuration.
while our other OS's do it in steps 1) lays down the image 2) sets the postconf 3) reboots
in our environment if the BIOS is set to a network device the system will stick in a provision loop, we use a status of 'kickstarted' to ovveride this behaviour in our other OS's so if the status=kickstarted the mac will be linked to localboot
How is this possible with an ESXI kscfg?
Here is an example of how we do it with Wndows:
REM Set Kickstart status to kickstarted
ECHO CURL -d macaddr=%PriNicMAC% -d status=kickstarted --url http://%ks_ipaddr%/cgi-bin/register.cgi
CURL -d macaddr=%PriNicMAC% -d status=kickstarted --url http://%ks_ipaddr%/cgi-bin/register.cgi
CURL -d macaddr=%PriNicMAC% -d error_message="%MESSAGE%" --url http://%ks_ipaddr%/cgi-bin/logError.cgi
of course we don't have curl, but we have wget.. and on linux we do an `nslookup kickstart` to get the IP of the kickstart server. Of course the nameservers are set during the provision so these variables are unavailable.
here's the start of the kscfg
accepteula
install --firstdisk=usb-storage,hpsa,local --overwritevmfs
rootpw @@RPASS@@
reboot
network --bootproto=static --addvmportgroup=false --device=vmnic0 --ip=@@IPADDR@@ --netmask=@@NETMASK@@ --gateway=@@GATEWAY@@ --nameserver=@@DNS1@@,@@DNS2@@ --hostname=@@HOST@@
%firstboot --interpreter=busybox
been messing around with wget and it doesn't appear to support the functionality required
wget http://kickstart/cgi-bin/postconf.cgi?macaddr=00:50:56:b8:61:ed -O-
pulls a postconf for a completely different mac
So I can not reliably determine the postconf variables or send messages to the correct entry.
Yep, wget is what I would recommend to use.
I also have a lot of tips/tricks for Kickstart installation for ESXi 5 if you have not seen this resource http://www.virtuallyghetto.blogspot.com/2011/07/automating-esxi-5x-kickstart-tips.html
hi Peer1Robb,
Welcome to the communites.
Seems you have rectified the problem yourself if i am not wrong.
Or let us know if you have still having same problem .
William,
That is exactly what I used when I started putting together the vSphere 5 offering. Excellent and helpful resource, Thank you!
The problem I am having is how the kscfg pretty much does everything in one fell swoop. I am thinking I may need to break it up into %pre and or %post sections.
here is the begining:
accepteula
install --firstdisk=usb-storage,hpsa,local --overwritevmfs
rootpw @@RPASS@@
reboot
network --bootproto=static --addvmportgroup=false --device=vmnic0 --ip=@@IPADDR@@ --netmask=@@NETMASK@@ --gateway=@@GATEWAY@@ --nameserver=@@DNS1@@,@@DNS2@@ --hostname=@@HOST@@
So I need to set up some variables (such as the IP of the kickstart server) before the host gets the configuration, becuase on the next boot it's no longer going to be able to resolve the kickstart hostname when the resolv.conf has been set to the external nameservers.
Also, I don't want to set the status to kickstarted(done) at this point since it's still in the process of setting up the configuration. That needs to happen after the last reboot at the end on the script. So I guess my question is, am I on the right path thinking about a %post/%pre
The next problem I've noticed is when I am using wget to pull postconf variables, even though I verified the mac was correct it was pulling info from a centOS server on the network with a macaddr of 00:00:00:00:00..
Thanks for the quick reply,
Robb
Well you can still resolve on the commandline by specifying the DNS server (take a look at nslookup) that can resolve your kickstart host OR just specify the IP Address if you know that won't be changing anytime soon. Recommendation is to do bare minimal or necessary things in %pre and do EVERYTHING else in %post, thats where the majority of your configurations should be setup. If you take a look at my extensive ks.cfg sample, that is exactly what I do and what I recommend
Hey William,
Thank you for your time. So I went back and modified my kscfg and put the %pre and %post sections in. I kept getting errors when running the network command.
Error: Network command not specified. Defaulting to DHCP
and then I get errors in about the syntax in the pre section not able to find any file in /tmp
So I went to basics and exactly copied your kscfg pre config section to echo out the network variable to /tmp/networkconfig'
I have the same exact problem,
Error: Network command not specified. Defaulting to DHCP
here is what I had (which worked) without the %pre
network --bootproto=static --addvmportgroup=false --device=vmnic0 --ip=@@IPADDR@@ --netmask=@@NETMASK@@ --gateway=@@GATEWAY@@ --nameserver=@@DNS1@@,@@DNS2@@ --hostname=@@HOST@@
Thanks, Robb
Here is wha I was trying to do in %post
%post --interpreter=busybox
export KSIPADDR=$(nslookup kickstart | awk '/Address/&&!/#/{print $3}')
export CGIBIN="http://${KSIPADDR}/cgi-bin"
export INTERFACE=${esxcli network nic list | grep vmnic | grep Up | awk '{print $1}')
export MACADDR=$(esxcli network nic list | grep vmnic | grep Up | awk '{print $7}')
export DHCPIP=$(esxcli network ip interface ipv4 get | grep vmk0 | awk '{print $2}')
wget -O- "${CGIBIN}/logError.cgi?macaddr=${MACADDR}&error_message=Finished Installing ESXi"
wget -O- "${CGIBIN}/logError.cgi?macaddr=${MACADDR}&error_message=Rebooting for posconf variables"
wget -O- "${CGIBIN}/updateks.cgi?macaddr=${MACADDR}&osload=localboot"
%end
INTERFACE is redundant at this time, it's a var we use with our RH builds, I am still new with all the esxcli commands.