This is the code repository for HashiCorp Packer in Production, published by Packt.
Efficiently manage sets of images for your digital transformation or cloud adoption journey
This book covers the following exciting features:
- Build and maintain consistent system images across multiple platforms
- Create machine images that can be used in multiple environments
- Write a spec for a local Packer virtual machine in JSON and HCL
- Build a container image with Packer in different formats
- Automate Packer with continuous delivery pipelines
- Discover how to customize Packer by writing plugins
If you feel this book is for you, get your copy today!
All of the code is organized into folders. For example, Chapter01.
The code will look like the following:
post-processor "compress" {
output = "{{.BuildName}}.gz"
compression_level = 7
}
Following is what you need for this book: This book is for DevOps engineers, Cloud engineers, and teams responsible for maintaining platform and application images for enterprise private, hybrid, or multi-cloud environments. Familiarity with operating systems and virtualization concepts, with or without using a cloud provider, is a prerequisite.
With the following software and hardware list you can run all code files present in the book (Chapter 1-12).
Software/hardware covered in the book | Operating system required |
---|---|
HCL2 | Platform agnostic |
JSON | Platform agnostic |
Golang | Platform agnostic |
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. Click here to download it.
- Packer Architecture
- History of Packer
- Who uses Packer?
- Installing Packer
- HCL vs JSON
- Hello World manifest for a local VM
- Breakdown of manifest components
- Using an IDE to help you write manifests
- Applying the VirtualBox builder
- Simplifying your manifest with variables
- Utilizing local system builders
- Adding cloud builders
- Installing to disk from classic install media, ISO, or network boot
- Applying installation profiles, kickstarts, jumpstarts, or package groups
- Running Ansible playbooks, Chef recipes, and Puppet manifests and profiles
- Installing cloud or hypervisor agents
- Enabling common services on first boot
- Container connections and shell tasks
- Managing stderr and stdout
- Using environment variables for logging and debugging
- Controlling flow
- Using breakpoints
- Adding applications deployable from vSphere
- Adding an AWS EC2 AMI build
- Adding an Azure build
- Adding a Google GCP build
- Parallel builds
- CI testing against multiple OS releases
- Pitfalls and Tthings to Aavoid
- Starting with LXC/LXD container images
- Docker container image format
- Podman/buildah plugin for OCI container image format
- Base image strategy
- Aggregation and branching out multiple pipelines
- Speeding up your builds with parallel processes
- Preventing parallel processes from causing DoS
- Troubleshooting logs in a parallel world
- Using image compression
- Selecting a compression algorithm for Packer images
- Selecting the right storage type for the image lifecycle
- Delta and patch strategies
- Tracking image lifecycle
- Using the Manifest post provisioner
- Creating a retention policy
- Creating an HCP Organization
- Configuring HCP Packer in your templates
- Consuming HCP Packer from Terraform
- Using HCP Image Ancestry
- Exploring the HCP REST API
- Identifying common automation requirements
- Exploring basic GitHub Actions support
- Exploring GitLab CI pipeline support
- Using Vault integration for pipelines
- Basics of GoLang
- Sample plugin source
- Building and testing your plugin
- Protecting yourself from bad plugins
Note: Chapter 12 requires its own dedicated GitHub repo: https://github.com/jboero/packer-plugin-nspawn