https://github.com/jacqinthebox/packer-templates
Building a development environment with Vagrant, Packer, Windows 10 and Server 2016
https://github.com/jacqinthebox/packer-templates
Last synced: 4 months ago
JSON representation
Building a development environment with Vagrant, Packer, Windows 10 and Server 2016
- Host: GitHub
- URL: https://github.com/jacqinthebox/packer-templates
- Owner: jacqinthebox
- License: mit
- Created: 2016-04-30T07:10:29.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-05-11T05:03:39.000Z (almost 4 years ago)
- Last Synced: 2024-08-14T07:06:42.832Z (8 months ago)
- Language: PowerShell
- Homepage: http://www.thebuttonfactory.nl/?p=3144
- Size: 67.5 MB
- Stars: 86
- Watchers: 9
- Forks: 18
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- jimsghstars - jacqinthebox/packer-templates - Building a development environment with Vagrant, Packer, Windows 10 and Server 2016 (PowerShell)
README
# Windows templates for Packer
## Introduction
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](https://github.com/mwrock/packer-templates) and by [https://github.com/MattHodge/PackerTemplates](https://github.com/MattHodge/PackerTemplates).
I was a bit stuck until I read [https://hodgkins.io/best-practices-with-packer-and-windows](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.## How to
### Prerequisites
The Windows boxes are created with Packer version 1.5.1 and are using WinRM.
[Vagrant](https://www.vagrantup.com), [Packer](https://www.packer.io) and Virtualbox.**Linux:**
Install them with your package provider or manually, for example like so:```bash
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/binwget 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:
```Powershell
Install-Package -ProviderName Chocolatey -ForceBootstrap -Force vagrant,virtualbox,packer
```### Clone and run
Clone the repository:
```
git clone https://github.com/jacqinthebox/packer-templates.git; cd packer-templates
```### Create a box
Create a Windows 10 box:
```bash
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:
```bash
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
```### Add the box to Vagrant
```bash
vagrant box add --name windows_10 windows10_vbox.box
```## Or just use the boxes from the Vagrant cloud
Create a Vagrantfile
```ruby
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```sh
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](https://app.vagrantup.com/boxes/search?order=desc&page=1&provider=&q=jacqinthebox)