Day 29–101 Days of DevOps — Introduction to Packer — Part 1

  • It integrates natively with a bunch of configuration management systems, e.g., Ansible, Puppet.
  • Packer is cross-platform(Linux/Window)
  • Packer uses a JSON template file and lets you define immutable infrastructure.
  • It’s written in the GO language.
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"sudo apt-get update && sudo apt-get install packer
  • Some Packer Options
packer
Usage: packer [--version] [--help] <command> [<args>]
Available commands are:
build build image(s) from template
console creates a console for testing variable interpolation
fix fixes templates from old versions of packer
fmt Rewrites HCL2 config files to canonical format
hcl2_upgrade transform a JSON template into an HCL2 configuration
init Install missing plugins or upgrade plugins
inspect see components of a template
validate check that a template is valid
version Prints the Packer version
  • Divided into three parts, each of them is a json array, so you can have as many as you want in each section.
  • Use to generate an image, and it’s provider-specific. E.g., if you create an image for AWS, your builder will tell the packer which AMI to start with and what region to create that AMI.
  • It let you customize your images.
  • These can be scripts(bash or PowerShell)or your existing configuration management system(e.g., chef, puppet, salt stack, and Ansible) or files where you can upload a file to the running instance for capturing things, e.g., config files, binaries, etc.
  • Let’s integrate with other services like Docker. E.g., it will let you upload an image to dockerhub.

--

--

--

AWS Community Builder, Ex-Redhat, Author, Blogger, YouTuber, RHCA, RHCDS, RHCE, Docker Certified,4XAWS, CCNA, MCP, Certified Jenkins, Terraform Certified, 1XGCP

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Steam Auto Login Project

Serverless Survey: +77% Delivery Speed, 4 Dev Workdays/Mo Saved & -26% AWS Monthly Bill

How We Do This? Part 1. Introduction

My Hack The North 2021 Experience

Strength Training Database Frontend

What are the Benefits of Automation Testing

Writing Python Code in a Pythonic Way Part-1: loops

My Journey with Coding Ninjas

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Prashant Lakhera

Prashant Lakhera

AWS Community Builder, Ex-Redhat, Author, Blogger, YouTuber, RHCA, RHCDS, RHCE, Docker Certified,4XAWS, CCNA, MCP, Certified Jenkins, Terraform Certified, 1XGCP

More from Medium

Introduction to Cloud Computing

Using Hands On Labs to Build Real-World Cloud Skills

Computer Networking Part One: Basics

How to prepare for the Terraform Associate