# Sample kickstart for ESXi 5.1 # William Lam # www.virtuallyghetto.com ######################################### accepteula install --firstdisk --overwritevmfs rootpw vagrant network --bootproto=dhcp reboot %firstboot --interpreter=busybox # enable VHV (Virtual Hardware Virtualization to run nested 64bit Guests + Hyper-V VM) grep -i "vhv.enable" /etc/vmware/config || echo "vhv.enable = \"TRUE\"" >> /etc/vmware/config # enable & start remote ESXi Shell (SSH) vim-cmd hostsvc/enable_ssh vim-cmd hostsvc/start_ssh # enable & start ESXi Shell (TSM) vim-cmd hostsvc/enable_esx_shell vim-cmd hostsvc/start_esx_shell # supress ESXi Shell shell warning - Thanks to Duncan (http://www.yellow-bricks.com/2011/07/21/esxi-5-suppressing-the-localremote-shell-warning/) esxcli system settings advanced set -o /UserVars/SuppressShellWarning -i 1 # ESXi Shell interactive idle time logout esxcli system settings advanced set -o /UserVars/ESXiShellInteractiveTimeOut -i 3600 # Disable IPv6 for VMkernel interfaces esxcli system module parameters set -m tcpip3 -p ipv6=0 ### FIREWALL CONFIGURATION ### # enable firewall esxcli network firewall set --default-action false --enabled yes # services to enable by default FIREWALL_SERVICES="syslog sshClient ntpClient updateManager httpClient netdump" for SERVICE in ${FIREWALL_SERVICES} do esxcli network firewall ruleset set --ruleset-id ${SERVICE} --enabled yes done # backup ESXi configuration to persist changes /sbin/auto-backup.sh # enter maintenance mode #esxcli system maintenanceMode set -e true # copy %first boot script logs to persisted datastore cp /var/log/hostd.log "/vmfs/volumes/datastore1/firstboot-hostd.log" cp /var/log/esxi_install.log "/vmfs/volumes/datastore1/firstboot-esxi_install.log" # Needed for configuration changes that could not be performed in esxcli esxcli system shutdown reboot -d 60 -r "rebooting after host configurations" %post --interpreter=python --ignorefailure=true import time stampFile = open('/finished.stamp', mode='w') stampFile.write( time.asctime() )