In the VM settings, there is an option to add properties to it. A good use case will be to have IP address configured to the VM when it’s provisioned for the time first from a template.
Below is a VM (it is a vitual ESXi VM). When you choose “Enable” in the vApp options, the vApp Options get expanded. 4 more lines are shown right away as highlighted below.
Notice the Properties is still “Not Configured” as we have not configured anything.
Select Advanced, and then click Properties, as shown in the picture below.
Clicking Properties will bring up the dialog box below. As we have not configured any property, it will be blank.
Click the New button. It brings up another dialog box. I know… it can get deep.
In the example below, I’ve keyed in the Label, Description. Click on the Type field.
Since I want to set the IP address, I need to choose the right type. Clicking Edit will bring up the dialog box below
Below are the options for both Static Property and Dynamic Property. Dynamic means the value must be determined. Example, it can grab the value of vCenter IP address.
In the Static Property, notice that there are “External IP Address” and “vApp IP Address”. vApp IP Address mean the value will come from the vApp, not externally. That means you need a mechanism to pass it. I will cover this a bit later.
I’ve chosen vApp IP Address as the type. Interestingly, I must specify the Network at this stage. If you know why, let me know. In large environment, the template might reside on a network that is different to the VM, or there are many VM networks that are sharing the same template. So hardcoding only 1 VM network looks like a limitation to me. Do correct me if this is not the case.
I’ve keyed in 2 properties. The result is shown below. Notice the types are different, because for the Subnet Mask, I chose “External IP Address” instead of “vApp IP Address”. In the “External IP Address”, there is no network to be chosen.
Remember the “vApp IP Address” I mentioned earlier? How do we pass the IP address value? How do we tell vCenter where to get it from?
To do that, you need to select Advanced, then click on “IP Allocation” button, as shown below.
This will bring up the IP Allocation dialog box, as shown by the arrow.
From there, click on OVF Environment. So we tell vCenter to get it from OVF Environment, which can be CD-ROM or VMware Tools.
So where do we specify it, and how to see the value?
To do that, select “OVF Settings”. In the screenshot below, I’ve chosen ISO Image as the vehicle to pass the value. So the OVF Environment takes the form a virtual CD-ROM, which the Guest OS can get the value from.
Since we want the IP address to be set one time only, and not at every reboot, there is an option to do that.
After we do all the above, going from screen to screen, what does it look like at the end?
The Properties part is now properly configured. So now we have a way to specify IP address, and vCenter has a way to pass it to the VM upon first boot.
For more info, see this blog post: http://blogs.vmware.com/vapp/2009/07/selfconfiguration-and-the-ovf-environment.html
Kindly note that the post is based on vSphere 4.0 while mine is 5.0. There is some minor difference I notice.
Hopefully the above helps in automating further.