Resource icon

Utility scripts for FreeNAS and VMware ESXi

I've created a GitHub repository containing the scripts I've written for use with my FreeNAS-on-ESXi All-In-One systems:

https://github.com/Spearfoot/utility-scripts-for-freenas-and-vmware-esxi

These might be handy for folks who haven't already cooked up their own solutions to the standard issues:
  • Forcing ESXi to rescan datastores so it will see the ones provided by FreeNAS
  • Starting up selected VMs when FreeNAS boots
  • Shutting down VMs gracefully when FreeNAS is shut down
  • Configuring FreeNAS to poll a UPS and shut down the ESXi host when needed
Scripts include:
  • esxi-poweroff-host.sh : Issue a poweroff command to the ESXi host
  • esxi-rescan-datastores.sh : Instruct the ESXi host to rescan its datastores (call from your FreeNAS startup script)
  • esxi-start-datastore-vms.sh : Start selected virtual machines
  • esxi-start-vm.sh : Start a virtual machine given its vmx name
  • esxi-stop-all-datastore-vms.sh : Gracefully shut down all running VMs in a given datastore
  • esxi-stop-all-vms.sh : Shut down all virtual machines on datastores provided by FreeNAS (call from your FreeNAS shutdown script)
  • esxi-stop-vm.sh : Shut down a virtual machine given its vmx name
  • startup-script.sh : Sample startup script for use as a FreeNAS postinit Init/Shutdown Task
  • shutdown-script.sh : Sample shutdown script for use as a FreeNAS shutdown Init/Shutdown Task
  • host.config : Sample host configuration settings
  • esxi.config : Common code for ESXi support

NOTE: The Network UPS Tools daemon on FreeNAS is unable to execute scripts because of permissions issues. So just specify the SSH command - ssh root@esxihostname poweroff - as the UPS Shutdown command, instead of using esxi-poweroff-host.sh.
Author
Spearfoot
Views
5,248
First release
Last update
Rating
5.00 star(s) 3 ratings

More resources from Spearfoot

Latest reviews

Robust and commented code :)
Just looking at the list of aspects you have covered is helpful in understanding the challenges of getting ESXi host with FreeNAS up and running. Thanks for sharing the results of your hard work!
Thank you for putting these all in one location Sir!
Top