Packer vpshere-iso Windows Repo
HashiCorp Packer is an awesome tool that you can use to create templates on a variety of platforms including VMware vSphere.
This post is basically a placeholder to my GitHub Repo that has code that uses the vsphere-iso builder to create a variety of Templates.
You can access the Repo at cwestwater/packer-vsphere-iso.
I’m not going to re-hash plenty of great content out there about Packer. I will however give you some great resources to learn:
- Stephan McTighe did a great series of posts on Getting Started with Packer to Create vSphere Templates
- Troy Lindsay presented a great session at VMware Code 2020 called CODE4234: Building VM Templates Programmatically with Packer with Troy Lindsay. Great video - I learnt a LOT from this video
- Michael Poore has an amazing repo with some great builds for most common OS’s
- HashiCorp Learn has lots of great tutorials on Packer available
The Packer build created the following Operating Systems:
- Windows Server 2016 Datacenter
- Windows Server 2016 Datacenter Core
- Windows Server 2016 Standard
- Windows Server 2016 Standard Core
- Windows Server 2019 Datacenter
- Windows Server 2019 Datacenter Core
- Windows Server 2019 Standard
- Windows Server 2019 Standard Core
- Windows Server 2022 Datacenter
- Windows Server 2022 Datacenter Core
- Windows Server 2022 Standard
- Windows Server 2022 Standard Core
I use the Evaluation ISOs from the Microsoft Evaluation Center for my lab.
The builds will create a VM that has the following specifications:
- 2 vCPUS
- 4GB RAM
- 20GB HDD
- HW version 17
- vmxnet 3 NIC
- PVSCSI Storage Controller
- VMware Tools installed automatically
Of course the specifications are easily changed by modifying the variables passed to the build.
I also perform some VM customisation as I detailed in these posts:
Once the OS is built the following OS customisations are performed:
- Disables TLS 1.0 and 1.1
- Disables a lot of services that are not needed
- Removes Features that are not required in a Server OS
- Some general OS customisations
The build then uses the amazing plugin Packer Windows Update Provisioner to update Windows with all the latest patches.
At the end of the process it converts the VM to a template.
Please go have a look at my repo cwestwater/packer-vsphere-iso on GitHub if you want to get an easy on ramp to Infrastructure as Code. Building Templates is an easy way to get started with IaC which could then be built on with tools such as Terraform to deploy those templates.
I will be keeping the repo up to date as Packer develops and I make changes to how I build my templates. I hope it helps someone get started with Packer.