When re-installing my home lab I realized that when using Auto Deploy with vCloud Director (vCD) you would need to have an extra step in the planning process, this makes sense if you think about the way that Auto Deploy and vCD works.
vCloud Director installs an agent on the ESXi host which is used for deploying virtual machines and other operations, if you think about the way Auto Deploy works, any change that is made to the host which is not part of your initial Image Profile or set in your Host Profile will be removed if the host is rebooted, this includes the vCD Agent.
On installing the VCD agent I was presented with the following error:
So I did as advised and consulted the documentation and found the following:
vCloud Director can manage stateful or stateless hosts. If you choose the stateless option, add the vCloud Director vSphere Installation Bundle (VIB) (which contains the agent) to the image profile. (Currently, this is a manual process as there is no API call to register VIBs in an image profile.) The vCloud Director VIB is loaded automatically when the host boots up. For preparation and un-preparation of stateless hosts, vCloud Director configures the agent using a host profile with an associated answer file.
If the host is rebooted, the appropriate image profile is reloaded when the host starts back up. vCloud Director detects the state change, and the configuration is re-pushed to the host.
If using stateless mode, avoid creating designs that require host-specific configuration. When converting a prepared stateful host to stateless, unprepare hosts prior to the conversion.
A useful start but unfortunately no mention of where to find the VIB I needed to include.
After consulting a colleague and expert of all things VCD Tom Stephens (Technical Marketing) he pointed me to the correct location to find the VIB and Auto Deploy package needed.
Adding the VCD Agent to you Image Profile
Copy the below zip file from your vCD Cell onto your machine where you are going to use the Image Builder and Auto Deploy PowerCLI Cmdlets.
The full location of this file is /opt/vmware/vloud-director/agent/vcloudagent-1.5.0-453916.zip
Add your custom Image Profile to your PowerCLI Session as in the below screenshot:
(or create a clone of an existing VMware profile using New-EsxImageProfile -CloneProfile “ExistingVMwareImageProfile” –Name “MyImageProfile” )
Next you need to add the software package which we copied from the vCD Cell to your current PowerCLI session using the below:
Once this has been added you can see the package in the list of software packages:
The next step is to add this software package to our custom image profile:
You can confirm the software package has been added to your image profile by using the following:
Once this has been completed you then need to update your Auto Deploy ruleset to deploy this new image profile and reboot the hosts which need the vCD Agent added.
After the reboot your ESXi Host will come back up with the vCD Agent Pre-installed and you will be able to add it into vCD:
Once you have edited your image profile like we did above if you close your PowerCLI session the MyImageProfile profile changes will be lost, this is because all the changes you are making are actually done in memory (your PowerCLI Session), make sure you always export your image profile and keep a copy in case you need to add more software packages or make further changes.
To do this use: