This repository contains Windows templates that can be used to create boxes for Vagrant using Packer. It is inspired by https://github.com/mwrock/packer-templates and by https://github.com/MattHodge/PackerTemplates. I was a bit stuck until I read https://hodgkins.io/best-practices-with-packer-and-windows. My previous approach of stuffing all box creating effort in 1 file was very cumbersome. Turns out you can use a modular approach with Packer by creating multiple artifacts and chain them together.
The Windows boxes are created with Packer version 1.5.1 and are using WinRM. Vagrant, Packer and Virtualbox.
Linux: Install them with your package provider or manually, for example like so:
wget https://releases.hashicorp.com/vagrant/2.2.6/vagrant_2.2.6_linux_amd64.zip
unzip vagrant_2.2.6_linux_amd64.zip
sudo mv vagrant /usr/local/bin
wget https://releases.hashicorp.com/packer/1.5.1/packer_1.5.1_linux_amd64.zip
unzip packer_1.5.1_linux_amd64.zip
sudo mv packer /usr/local/bin
Windows VirtualBox:
You can install the prerequisites with packagemanagement:
Install-Package -ProviderName Chocolatey -ForceBootstrap -Force vagrant,virtualbox,packer
Clone the repository:
git clone https://github.com/jacqinthebox/packer-templates.git; cd packer-templates
Create a Windows 10 box:
packer build --force virtualbox_windows_10_1_base.json
packer build --force virtualbox_windows_10_2_updates.json
packer build --force virtualbox_windows_10_3_package.json
Create a Windows Server 2019 box:
packer build --force virtualbox_windows_server_2019_1_base.json
packer build --force virtualbox_windows_server_2019_2_updates.json
packer build --force virtualbox_windows_server_2019_3_package.json
vagrant box add --name windows_10 windows10_vbox.box
Create a Vagrantfile
Vagrant.configure("2") do |config|
config.vm.define "lab01" do |lab01_config|
lab01_config.vm.box = "jacqinthebox/windows10"
lab01_config.vm.hostname ="lab01"
lab01_config.vm.provider "virtualbox" do |v|
v.linked_clone = true
end
end
end
And do
vagrant up
This may take a while because the boxes are around 6 Gigabytes.
https://app.vagrantup.com/boxes/search?order=desc&page=1&provider=&q=jacqinthebox