
What is Packer
Packer is a simple, easy open source tool from HashiCorp that runs on all major operating systems and is ued to create identical machine images for different platforms from a single source configuration template.
Packer Templates
A Packer templates is a json formatted file containing the build information. A Packer templates consist of different sections:
Variables
– variables allow you to set API keys and other variable settings without changing the configuration file
Builders (required)
– generates your image
– provider specific
– multiple builders are possible within he same json file
– One required field = type. The type specifies the provider which you will build your image on (e.g amazon-ebs, vmware-iso, hyperv-iso, virtualbox-ova, openstack, …)
– Other required fields depend on the provider
Provisioners
– customises your image
– a set of scripts (bash, powershell, …) or configuration management integration (puppet, chef, ansible, …)
– can be builder specific
– One required field = type
– Other required fields depend on the type
– “Only” field specifies on which provisioners you want this provisioner to run with
Post-processors
– put in the finishing touches on images
– integration with other services
– One required field = type
– Other required fields depend on the type
– “Only” field specifies on which provisioners you want this provisioner to run with
Packer Installation
Installation of packer: See https://www.packer.io/intro/getting-started/install.html#precompiled-binaries
– For Windowes: Copy packer.exe to a folder on your computer and ensure that the folder where you copied packer.exe into is included into your path