How to use Packer v1.6 to build a Windows Server template for VMware vSphere
Note: the code in this is story is compatible with Packer v1.6.x. For Packer v1.5.x and previous versions please take a look at this story.
Packer is an open-source tool used to create virtual machine templates from a .json file.
To automatize the creation of templates in VMware vSphere, there are two major approaches:
- Use the VMware-iso provider. This provider creates VMware VMs from an ISO file as a source. It currently supports building virtual machines on hosts running VMware Fusion for OS X, VMware Workstation for Linux & Windows, VMware Player on Linux, and the free VMware ESXi Hypervisor.
- Use the vSphere-iso provider. This provider originally created by JetBrains and now is merged into the official Packer repository and released with Packer. It builds VMs on VMware vSphere directly using vSphere API.
In this story, we will use the vsphere-iso provider to create a Windows Server 2019 using Packer for VMware vSphere with vCenter.
Creating Linux templates with Packer is an almost a straight forward process, however, Windows Server templates will require some extra work. If you want to learn more about the process of building Linux Templates with Packer, check the following posts.