The Packer Book

Book description

A hands-on introduction to Packer, the HashiCorp image builder. Packer helps engineers, developers, sysadmins, and operations staff build multi-platform images including support for Docker containers, virtual machines, and Cloud-based images for platforms like Amazon Web Services and Google Cloud. Packer allows you to build consistent images on Linux, Microsoft Windows, macOS and other operating systems. In the book, we'll teach you how to install, use and integrate Packer into your environment and work flow. The book includes chapters on:

* Installing Packer.
* Building images.
* Provisioning images.
* Integration with Configuration Management tools like Ansible, Chef, and Puppet.
* Packer and Docker containers.
* Integrating and writing infrastructure tests.
* Building pipelines for Continuous Integration with Packer.
* Extending Packer.

Table of contents

  1. The Packer Book
    1. 0.1 Who is this book for?
    2. 0.2 Credits and acknowledgments
    3. 0.3 Technical reviewers
      1. 0.3.1 Rickard von Essen
      2. 0.3.2 Ben Allen
      3. 0.3.3 Daniel Linder
    4. 0.4 Editor
    5. 0.5 Author
    6. 0.6 Conventions in the book
    7. 0.7 Code and examples
    8. 0.8 Colophon
    9. 0.9 Errata
    10. 0.10 Disclaimer
    11. 0.11 Copyright
    12. 0.12 Version
  2. 1 Introduction to Packer
    1. 1.1 Introducing Packer
      1. 1.1.1 Why use Packer?
      2. 1.1.2 Packer use cases
    2. 1.2 Some other image management tools
    3. 1.3 Packer links
  3. 2 Installing Packer
    1. 2.1 Installing Packer
      1. 2.1.1 Installing Packer on Linux and macOS
      2. 2.1.2 Installing Packer on Microsoft Windows
      3. 2.1.3 Installing from source
    2. 2.2 Summary
  4. 3 First steps with Packer
    1. 3.1 Setting up Amazon Web Services
    2. 3.2 Running Packer
    3. 3.3 Creating an initial template
    4. 3.4 Variables
      1. 3.4.1 Environment variables
      2. 3.4.2 Populating variables
    5. 3.5 Builders
    6. 3.6 Communicators
    7. 3.7 Validating a template
    8. 3.8 Building our image
    9. 3.9 Summary
  5. 4 Provisioning with Packer
    1. 4.1 Provisioner basics
    2. 4.2 Provisioning via the shell provisioner
      1. 4.2.1 Running a script
      2. 4.2.2 Running more than one script
    3. 4.3 File provisioning
      1. 4.3.1 Uploading a directory
    4. 4.4 Provisioning via configuration management
      1. 4.4.1 Puppet standalone
      2. 4.4.2 Puppet server
    5. 4.5 Summary
  6. 5 Docker and Packer
    1. 5.1 Getting started with Docker and Packer
    2. 5.2 A basic Docker build
    3. 5.3 Provisioning a Docker image
    4. 5.4 Instructions and changes
    5. 5.5 Post-processing Docker images
    6. 5.6 Summary
  7. 6 Testing Packer
    1. 6.1 Our test scenario
      1. 6.1.1 Installing Puppet
      2. 6.1.2 Hiera and manifest data
      3. 6.1.3 Installing modules
      4. 6.1.4 The Puppet standalone provisioner
      5. 6.1.5 Uploading our tests
      6. 6.1.6 Running Serverspec
    2. 6.2 Serverspec tests
      1. 6.2.1 Setting up Serverspec
      2. 6.2.2 Creating our first Serverspec tests
      3. 6.2.3 The Serverspec NTP tests
      4. 6.2.4 The Rakefile
    3. 6.3 Running our tests
    4. 6.4 Summary
  8. 7 Pipelines and workflows
    1. 7.1 Our build pipeline
    2. 7.2 Our pipeline template
      1. 7.2.1 Variables
      2. 7.2.2 Builders
      3. 7.2.3 Provisioners
      4. 7.2.4 Post-processors
      5. 7.2.5 Execution
      6. 7.2.6 Continuous Integration
    3. 7.3 Summary
  9. 8 Extending Packer
    1. 8.1 Packer plugins
      1. 8.1.1 Installing a plugin
    2. 8.2 Writing our own plugins
      1. 8.2.1 Building a plugin
      2. 8.2.2 Naming plugins
      3. 8.2.3 Plugin basics
    3. 8.3 Summary

Product information

  • Title: The Packer Book
  • Author(s): James Turnbull
  • Release date: July 2017
  • Publisher(s): Turnbull Press
  • ISBN: None