Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #528 from jasonberanek/esxi-5.0u2-template

ESXi 5.0u2 template for VMware Fusion
  • Loading branch information...
commit 16373c75f91ac6a83804eb8729ea02287d59bca8 2 parents 841c37e + 9777d7d
@jedi4ever authored
View
26 templates/VMware-ESXi-5.0u2-x86_64/definition.rb
@@ -0,0 +1,26 @@
+Veewee::Session.declare({
+ :cpu_count => '2', :memory_size=> '2048',
+ :disk_size => '20140', :disk_format => 'VDI', :hostiocache => 'off', :ioapic => 'on', :pae => 'on',
+ :os_type_id => 'ESXi5',
+ :iso_file => "VMware-VMvisor-Installer-5.0.0.update02-914586.x86_64.iso",
+ :iso_src => "",
+ :iso_download_instructions => "- You need to download this manually as there is no automated way to do it\n"+
+ "https://my.vmware.com/web/vmware/details?downloadGroup=ESXI50U2&productId=229&rPId=3282\n" +
+ "Registration is required to complete the download\n"+
+ "\n"+
+ "- The version tested is 5.0.0 update 2 version 914586\n"+
+ "- For other versions: changed the iso filename+checksum\n",
+ :iso_md5 => "fa6a00a3f0dd0cd1a677f69a236611e2",
+ :iso_download_timeout => 1000,
+ :boot_wait => "15",
+ :boot_cmd_sequence =>
+ [ 'O',
+ ' ks=http://%IP%:%PORT%/ks.cfg<Enter>' ],
+ :kickstart_port => "7122", :kickstart_timeout => 10000, :kickstart_file => "ks.cfg",
+ :ssh_login_timeout => "10000000", :ssh_user => "root", :ssh_password => "vagrant", :ssh_key => "",
+ :ssh_host_port => "7222", :ssh_guest_port => "22",
+ :sudo_cmd => "echo '%p'|sudo -S sh '%f'",
+ :shutdown_cmd => "/bin/halt",
+ :postinstall_files => ["vagrant_key.py", "vnc_enable.sh" ], :postinstall_timeout => 10000,
+ :vmfusion => { :vm_options => { 'enable_hypervisor_support' => true, 'download_tools' => false } }
+})
View
63 templates/VMware-ESXi-5.0u2-x86_64/ks.cfg
@@ -0,0 +1,63 @@
+# 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() )
View
6 templates/VMware-ESXi-5.0u2-x86_64/vagrant_key.py
@@ -0,0 +1,6 @@
+#!/bin/python
+
+import urllib
+
+vagrant_key = "https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub"
+urllib.urlretrieve( vagrant_key, "/etc/ssh/keys-root/authorized_keys")
View
40 templates/VMware-ESXi-5.0u2-x86_64/vnc_enable.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+mkdir /store/firewall
+
+# Copy the service.xml firewall rules to a central storage
+# so they can survive reboot
+cp /etc/vmware/firewall/service.xml /store/firewall
+
+# Remove end tag so rule addition works as expected
+sed -i "s/<\/ConfigRoot>//" /store/firewall/service.xml
+
+# Add rule for vnc connections
+echo "
+ <service id='0033'>
+ <id>vnc</id>
+ <rule id='0000'>
+ <direction>inbound</direction>
+ <protocol>tcp</protocol>
+ <porttype>dst</porttype>
+ <port>
+ <begin>5900</begin>
+ <end>5964</end>
+ </port>
+ </rule>
+ <enabled>true</enabled>
+ <required>false</required>
+ </service>
+</ConfigRoot>" >> /store/firewall/service.xml
+
+# Copy updated service.xml firewall rules to expected location
+# Refresh the firewall rules
+cp /store/firewall/service.xml /etc/vmware/firewall/service.xml
+esxcli network firewall refresh
+
+# Add steps to profile.local to repeat these steps on reboot
+echo "
+cp /store/firewall/service.xml /etc/vmware/firewall/service.xml
+esxcli network firewall refresh" >> /etc/rc.local
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.