This project aims to expose a simple, configurable and tailored packer template for building Vagrant base boxes for Hyper-V.
There are many templates, and existing Vagrant boxes available so why bother re-inventing the wheel? Well in my experience all the projects I looked at either tried to do too much or had Hyper-V as a second class citizen. Further more if I wanted to configure the build boxes I had to fully understand the project and where it's configuration is hidden.
So the goals for this project are simple:
- Hyper-V must be the main supported builder.
- Limit the number of supported OS's to enable a clean project without a large amount of if/else style configuration.
- Make anything that a user might want to modify configurable within a build process without the need to resort to modifing templates or internal OS installation files etc.
- Packer
- PowerShell - for our build scripts
- Hyper-V
- Windows 10 build 17063 or greater is required for enhanced mode support. See https://blogs.technet.microsoft.com/virtualization/2018/02/28/sneak-peek-taking-a-spin-with-enhanced-linux-vms/
- Intel CPU with VT-X - needed for nested virtualization. If you do not have a supported CPU set
enable_virtualization_extensions
tofalse
inhyperv-windows-10.json
A PowerShell build script has been created to handle build and configuration for the vagrant boxes.
From a PowerShell command prompt in the project root:
get-help .\build.ps1 -detailed
This will show all the configuration options available.
A default build can be run like this:
.\build.ps1
A PowerShell build script has been created to handle build and configuration for the vagrant boxes.
From a PowerShell command prompt in the project root:
get-help .\build-windows.ps1 -detailed
This will show all the configuration options available.
A default build can be run like this:
.\build-windows.ps1
In keeping with my project goals above, Ubuntu 20.04 x64 and Windows 10 x64 (2004) are the only supported box OS's at this stage.
The build script has a -debug option which sets some packer options to aid in debugging faulty templates. Start with the generated log file: packer-log.txt