{"id":14064584,"url":"https://github.com/MattHodge/PackerTemplates","last_synced_at":"2025-07-29T18:33:08.368Z","repository":{"id":77493006,"uuid":"69505766","full_name":"MattHodge/PackerTemplates","owner":"MattHodge","description":"Packer Templates for building Windows Operating Systems","archived":false,"fork":false,"pushed_at":"2018-02-04T07:00:11.000Z","size":55,"stargazers_count":163,"open_issues_count":4,"forks_count":62,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-08-14T07:07:16.803Z","etag":null,"topics":["hyper-v","packer","packer-template","virtualbox"],"latest_commit_sha":null,"homepage":"https://hodgkins.io/best-practices-with-packer-and-windows","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MattHodge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-09-28T21:36:20.000Z","updated_at":"2024-05-18T15:02:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"56846005-3c6d-487b-801b-b477571fc8cb","html_url":"https://github.com/MattHodge/PackerTemplates","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattHodge%2FPackerTemplates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattHodge%2FPackerTemplates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattHodge%2FPackerTemplates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattHodge%2FPackerTemplates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MattHodge","download_url":"https://codeload.github.com/MattHodge/PackerTemplates/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228040731,"owners_count":17860211,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hyper-v","packer","packer-template","virtualbox"],"created_at":"2024-08-13T07:03:56.687Z","updated_at":"2024-12-04T03:31:04.895Z","avatar_url":"https://github.com/MattHodge.png","language":"PowerShell","funding_links":[],"categories":["PowerShell"],"sub_categories":[],"readme":"# Windows Packer Templates\n\n\u003c!-- TOC depthFrom:2 --\u003e\n\n- [Introduction](#introduction)\n    - [Supported Builders](#supported-builders)\n    - [Supported Operating Systems](#supported-operating-systems)\n    - [Pre-build Images](#pre-build-images)\n- [Prepare your system to run Packer](#prepare-your-system-to-run-packer)\n    - [Ubuntu](#ubuntu)\n    - [Windows](#windows)\n- [Running the Build Script](#running-the-build-script)\n    - [Building Vagrant Cloud Images](#building-vagrant-cloud-images)\n    - [Building Hyper-V Images](#building-hyper-v-images)\n    - [Building VirtualBox Images](#building-virtualbox-images)\n- [Using the Vagrant Images](#using-the-vagrant-images)\n\n\u003c!-- /TOC --\u003e\n\n## Introduction\nThis repository contains build scripts to golden images using Packer.\n\nInterested in some best practices when using Packer with Windows? Check out [my blog post on the topic](https://hodgkins.io/best-practices-with-packer-and-windows).\n\n### Supported Builders\n\nThe supported builds are:\n* VirtualBox\n* Hyper-V\n\n### Supported Operating Systems\n\nThe `build.supported_os.yaml` file contains the list of Operating Systems that are supported and their settings.\n\nThe supported Operating Systems to build are:\n* Windows2012R2Core\n* Windows2012R2\n* Windows2016StdCore\n* Windows2016Std\n\n### Pre-build Images\n\nIf you just want to download the pre-build Vagrant images, download them from [Vagrant Cloud](https://app.vagrantup.com/MattHodge).\n\n## Prepare your system to run Packer\n\nBefore you can run the build scripts, you need to prepare your system.\n\n### Ubuntu\n\n\u003e :white_check_mark: Tested on Ubuntu 16.04\n\nMono is required to run the build script.\n\n```bash\n# Install Mono\nsudo apt-get install mono-complete -y\n\n# Give the script execute permission\nchmod +x build.sh\n```\n\nAdditionally you will need to install:\n\n* Packer\n* VirtualBox\n\n### Windows\n\n\u003e :white_check_mark: Tested on Windows 10 Pro\n\n```powershell\n# Set PowerShell Execution Policy\nSet-ExecutionPolicy RemoteSigned -Force\n\n# Install Chocolatey\niwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex\n\n# Install Packer\nchoco install packer -y\n\n# Install Hyper-V\nEnable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All\n\n# Create an external Hyper-V Switch\n# Commands may vary depending on your system.\nGet-NetAdapter\n\n# Find the name of the network adapter (make sure its status is also not disconnected)\n\n# Create a new VM Switch using the name of the network adapter\nNew-VMSwitch -Name \"External VM Switch\" -AllowManagementOS $true -NetAdapterName \"\u003cYour Adapter Name Here\u003e\"\n```\n\n## Running the Build Script\n\nDepending on your platform, you either need to run:\n* `build.ps1` on Windows\n* `build.sh` on Linux / MacOS.\n\n### Building Vagrant Cloud Images\nIf you are building images for Vagrant Cloud, you need to set the following environment variables:\n\n```powershell\n# Windows\n\n$env:ATLAS_TOKEN = \"ABC123XYZ\"\n\n$env:ATLAS_USERNAME = \"MattHodge\" # Username to upload the boxes under\n\n$env:ATLAS_VERSION = \"1.0.1\" # Version of the box being uploaded\n```\n\n```bash\n# MacOS / Linux\n\nexport ATLAS_TOKEN=\"ABC123XYZ\"\n\nexport ATLAS_USERNAME=\"MattHodge\" # Username to upload the boxes under\n\nexport ATLAS_VERSION=\"1.0.1\" # Version of the box being uploaded\n```\n\n\n### Building Hyper-V Images\n\nThe following commands will build you Hyper-V Images\n\n```powershell\n# Builds Windows 2016 Standard Core and runs the Vagrant post processor (local).\n.\\build.ps1 -Target \"hyperv-local\" -os=\"Windows2016StdCore\"\n\n# Builds Windows 2012 R2 Core and runs the Atlas post processor.\n.\\build.ps1 -Target \"hyperv-vagrant-cloud\" --os=\"Win2012R2Core\"\n```\n\n### Building VirtualBox Images\n\nThe following commands will build you VirtualBox Images\n\n```bash\n# Builds Windows 2016 Standard Core and runs the Vagrant post processor (local).\n./build.sh --target \"virtualbox-local\" -os=\"Windows2016StdCore\"\n\n# Builds Windows 2012 R2 Core and runs the Atlas post processor.\n./build.sh --target \"virtualbox-vagrant-cloud\" -os=\"Win2012R2Core\"\n```\n\n## Using the Vagrant Images\n\nIf you aren't pushing your boxes to Atlas, you can import the `*.box` files for use in Vagrant:\n\n```powershell\nvagrant box add .\\win2016stdcore-wmf5-nocm-hyperv.box --name Windows2016StdCore\n```\n\nYou can also find all the boxes ready to be used with `vagrant up` over at my [VagrantBoxes Repository](https://github.com/MattHodge/VagrantBoxes).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMattHodge%2FPackerTemplates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMattHodge%2FPackerTemplates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMattHodge%2FPackerTemplates/lists"}