Once again, Razor comes to the rescue for all of you who’d like to automate the installations of VMware ESXi 5.1 that was just publically released. If you already have a Razor environment up and running you can dive right into the howto below, otherwise please use the howto I posted earlier to get started with Razor and Puppet.
(Disclaimer: I am using Razor version 0.1.6.0 which was the latest version on the PuppetForge while writing this howto.)
Now, let’s get to it!
First, download the VMware ESXi 5.1 ISO from here. Next, upload the file to your Razor server, preferrably with FileZilla or some other tool.
Next, add the ISO as an image in Razor:
root@puppet:~# razor image add esxi ./VMware-VMvisor-Installer-5.1.0-799733.x86_64.iso Attempting to add, please wait... New image added successfully Added Image: UUID => 29XxYGoid8kr6KVmyFp00O Type => VMware Hypervisor Install ISO Filename => VMware-VMvisor-Installer-5.1.0-799733.x86_64.iso Path => /opt/razor/image/esxi/29XxYGoid8kr6KVmyFp00O Status => Valid Version => VMware ESXi 5.1 GA
Now look at that, Razor already knows that this is the GA version of ESXi 5.1, how cool is that?
Let’s go ahead and create a new model with this image as well:
root@puppet:~# razor model add template=vmware_esxi_5 label=install_esxi5.1 image_uuid=29XxYGoid8kr6KVmyFp00O --- Building Model (vmware_esxi_5): Please enter ESX License Key (example: AAAAA-BBBBB-CCCCC-DDDDD-EEEEE) (QUIT to cancel) > AAAAA-BBBBB-CCCCC-DDDDD-EEEEE Please enter root password (> 8 characters) (example: P@ssword!) default: test1234 (QUIT to cancel) > test1234 Please enter IP Network for hosts (example: 192.168.10) (QUIT to cancel) > 192.168.72 Please enter IP Subnet (example: 255.255.255.0) default: 255.255.255.0 (QUIT to cancel) > 255.255.255.0 Please enter Starting IP address (1-254) (example: 1) (QUIT to cancel) > 201 Please enter Ending IP address (2-255) (example: 50) (QUIT to cancel) > 210 Please enter Gateway for node (example: 192.168.1.1) (QUIT to cancel) > 192.168.72.130 Please enter Prefix for naming node (example: esxi-node) (QUIT to cancel) > esxi-node Please enter Nameserver for node (example: 192.168.10.10) (QUIT to cancel) > 192.168.72.130 Please enter NTP server for node (example: ntp.razor.example.local) (QUIT to cancel) > se.pool.ntp.org Please enter Optional for broker use: the vCenter to attach ESXi node to (example: vcenter01) (SKIP to skip, QUIT to cancel) > SKIP Please enter Optional for broker use: the vCenter Datacenter path to place ESXi host in (example: Datacenter01) (SKIP to skip, QUIT to cancel) > SKIP Please enter Optional for broker use: the vCenter Cluster to place ESXi node in (example: Cluster01) (SKIP to skip, QUIT to cancel) > SKIP Model created Label => install_esxi5.1 Template => vmware_hypervisor Description => VMware ESXi 5 Deployment UUID => d29A59f849662DlZ5g4tk Image UUID => 29XxYGoid8kr6KVmyFp00O
That worked like a charm. Now create a policy with some rules as well, I am using a VM with 2 CPUs and 3GB of RAM to create my new ESXi hosts. I also set a rule that no more than 10 ESX hosts should be deployed with this policy.
root@puppet:~# razor policy add -p vmware_hypervisor -l VMware_ESXi_5.1 -m d29A59f849662DlZ5g4tk -t cpus_2,memsize_3GiB -e -x 10 Policy created UUID => 4fvRHmRkLc94Huuh45i60e Line Number => 4 Label => VMware_ESXi_5.1 Enabled => true Template => vmware_hypervisor Description => Policy for deploying a VMware hypervisor. Tags => [cpus_2, memsize_3GiB] Model Label => install_esxi5.1 Broker Target => none Currently Bound => 0 Maximum Bound => 10 Bound Counter => 0
Let’s look at the policies we have:
root@puppet:~# razor policy Policies # Enabled Label Tags Model Label #/Max Counter UUID <snip> 4 true VMware_ESXi_5.1 [cpus_2,memsize_3GiB] install_esxi5.1 0/10 0 4fvRHmRkLc94Huuh45i60e
Now start your VM/physical host that has the right set of hardware to match the policy, and watch the ESXi automatically install itself using the settings you’ve set. Go grab a coffee, it should be done within 10 minutes.
Voila! Now that it’s installed, you can browse to the IP Address that’s been set and download the vSphere Client to configure the host properly.
Enjoy, and have fun playing with the newest release of VMware ESXi!
