Closed Phat3 closed 2 years ago
Hi @clong!
I had to add the 2 additional answer files because when deploying a Windows VM on vCenter the VMware Tools are not installed by default. Without VMware tools installed, the IP address of the VM is not correctly exposed through the APIs, and therefore Packet won't be able to get the IP and connect back to that VM and execute post-installation scripts.
In the 2 new answer files, I added the part to automatically install those tools. Specifically, those files are identical to DetectionLab//Packer/answer_files/10
and DetectionLab//Packer/answer_files/2016
respectively, except for the following part:
<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Order>1</Order>
<!-- Install VMware Tools from windows.iso -->
<Path>a:\vmtools.cmd</Path>
<WillReboot>Always</WillReboot>
</RunSynchronousCommand>
</RunSynchronous>
</component>
This part executes a custom script I wrote to install the VMware tools (which is mounted at boot time as a floppy_file
in the Packer config)
Makes sense -- PR looks good, thank you!
Makes sense -- PR looks good, thank you!
Hi!
I added the support for creating images on vSphere environments using Packer.
The existing build chain for ESXi uses the vmware-iso Packer builder which is not fully compatible with vCenter. Specifically, I encountered the following bugs while deploying:
To solve those issues I ported the Packer build configuration to the Packer builder vsphere-iso which is fully compatible with vCenter (Tested on the latest version of vCenter).
This PR contains the following new files:
ESXi/Packer/ubuntu2004_vsphere.json
:vsphere-iso
Packer config file forUbuntu 20.04
ESXi/Packer/windows_10_vsphere.json
:vsphere-iso
Packer config file forWindows 10
ESXi/Packer/windows_10_vsphere.json
:vsphere-iso
Packer config file forWindows Server 2016
ESXi/Packer/variables_vsphere.json
: variables used by the new configPacker/answer_files/10_vsphere/Autounattend.xml
: a modified version of theAutounaddend.xml
that launches a script to install the VMware tools at boot time when a new Windows 10 image is createdPacker/answer_files/2016_vsphere/Autounattend.xml
: a modified version of theAutounaddend.xml
that launches a script to install the VMware tools at boot time when a newWindows Server 2016
image is createdPacker/scripts/vmtools.cmd
: script that installs the VMware tools and launched by theAutounattend.xml
filesThe command that needs to be used to run Packer is the same as the one used when building the images for ESXi but changing the paths to the new configuration files (e.g.,
PACKER_CACHE_DIR=../../Packer/packer_cache packer build -var-file variables_vsphere.json ubuntu2004_vsphere.json
)Signed-off-by: Sebastiano Mariani smariani@vmware.com