VMware vSphere - Scripted Installer for ESX Server - The esx-post-script

PDF Print E-mail

The ESX-POST-SCRIPT script

That's everything that happens before the reboot sorted out.  What we've go so far is a network configuration that's personalised for the server, a disk-partition and VMDK container that's personalised for the server, and a configuration-script.

Now that the server is also rebooted, we have full access to all the ESX tools, so we can do the final configuration.

The sole role of esx-post-script.sh is basically to create a runnable esxcfg.sh file that contains all the standard ESX commands for setting up a host.

esx-post-script
  1. ESXID=$1
  2. ESXCODE=`printf "%02d\n" "$ESXID"`
  3. ESXHOSTNAME="ESX-$ESXCODE"
  4. ESXSCIP="10.20.30.$ESXID"
  5. ESXSTORAGEIP="10.10.30.$ESXID"
  6. cat > /esxcfg.sh <<eofcfg>
  7. # MORE CONFIG WILL GO HERE, THAT COMES LATER
  8. EOFcfg
  9. cp -f /etc/rc.d/rc.local /etc/rc.d/rc.local.bak
  10. cat > /etc/rc.d/rc.local << EOFrc
  11. chmod a+x esxcfg.sh
  12. bash /esxcfg.sh > /root/post_install.log
  13. cp -f /etc/rc.d/rc.local /etc/rc.d/rc.postinstall
  14. cp -f /etc/rc.d/rc.local.bak /etc/rc.d/rc.local
  15. EOFrc
 

  1. esx-post-script.sh creates a new customised script esxcfg.sh
  2. esx-post-script.sh backs up the current /etc/rc.init file
  3. esx-post-script.sh puts esxcfg.sh into rc.init


Last Updated on Wednesday, 05 August 2009 12:53