At my $DAYJOB, the need recently arose for not only making our software available as an installer that the end-user can install on their machines, but also for providing pre-built OVF (Open Virtualization Format) images, mainly targeted towards costumers running VMware vSphere and wanting to not have software running on bare metal. They can of course run the regular installer, but providing a pre-installed image cuts deployment time considerably and eliminates many of the mistakes that can be done while performing the installation.
Hunting around for solutions on how to actually generate these images, using some kind of automated procedure as we will regenerate the images several times and in slightly different configurations, I eventually landed on Packer. Packer lets me drive VMWare Workstation by submitting a configuration file listing an ISO image to install from and giving the commands necessary to run the installation automatically.
One of the issues with doing this is that most installations will add some unique identifiers in the image, and we do not want that. For instance, SSH host keys are generated, as are MAC addresses for the network cards, and also some other stuff is dropped. Fortunately, I was not the first one to have faced this problem, so it was fairly easy to find a solution that would clean up the generated image. In addition to that, I had the post-install script install VMWare Tools in the virtual image, and then go on to remove various UUIDs and MAC addresses from the generated VMWare configuration file.
The result of running Packer is, however, still a VMWare image. It does have a driver for OVF, but that one is using Oracle VirtualBox instead. OVF is supposed to be platform-independent but there are enough differences between how the images are built to create trouble if we use the wrong build platform. Instead we landed on using VMWare OVF Tool on the generated VMWare image, converting it into an OVF archive (.ova). This is the part that takes the longest time in our build process, which starts out with generating the ISO to install from on-the-fly. But in the end, we have an OVA file that can be imported into VMWare (vSphere, Workstation or Player all work fine) and be up and running in under two minutes.