Member-only story

Creating Proxmox Templates With Packer

Aaron Berry
6 min readApr 1, 2020

--

I’ve been using proxmox for a while now in my homelab as an open-source alternative for a virtualization platform like ESXi. One useful feature in proxmox is the templates which allows us to create a LXC or VM templates that can then be cloned as a starting off point for new proxmox resources. Now with these templates we are able to have a standard starting point to install our applications on top of, pre install packages for authentication, security, logging and etc without anyone else needing to think about it as we bake these best practices right into these template resources.

However, creating and managing these templates can become a challenge with how time-consuming and manual it can be. I want to show you how you can make this process more standardized and automated with the use of packer codify your proxmox templates and orchestrating the building and packaging of these templates so they are available for use on your proxmox hosts.

What is packer

Packer is a utility that allows you to build virtual machine images so that you can define a golden image as code. Packer can be used to create images for almost all of the big cloud providers such as AWS, GCE, Azure and Digital Ocean, or can be used with locally installed hypervisors such as VMWare, Proxmox and a few others.

To build an image with packer we need to define our image through a template file. The file uses the JSON format and comprises of 3 main sections that are used to define and prepare your image.

  • Builders: Components of Packer that are able to create a machine image for a single platform. A builder is invoked as part of a build in order to create the actual resulting images.
  • Provisioners: Install and configure software within a running machine prior to that machine being turned into a static image. Example provisioners include shell scripts, Chef, Puppet, etc.
  • Post Processors: Take the result of a builder or another post-processor and process that to create a new artifact. Examples of post-processors are compress and upload to compress and upload artifacts respectively, etc.

By using packer we can define our golden VM image as code so that we can easily build identically configured images on demand so…

--

--

Aaron Berry
Aaron Berry

Written by Aaron Berry

Software Engineer working in Data Engineer and DevOps. Tinkering with anything automation, containers and servers in the cloud.

No responses yet

Write a response