Packer Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Packer =Builder=")
 
 
(23 intermediate revisions by the same user not shown)
Line 1: Line 1:
=External=
* https://www.packer.io/docs/
=Internal=
=Internal=


* [[Packer#Concepts|Packer]]
* [[Packer#Concepts|Packer]]
=Artifact=
An artifact is the result of a single build, and it is usually a set of IDs or a file to represent a machine image. Every [[#Builder|builder]] produces a single artifact. In the case of the Amazon EC2 builder, the artifact is a set of AMI IDs (one per region). For the VMware builder, the artifact is a directory of files comprising the created virtual machine.
=Template=
Templates are JSON files which define one or more [[#Build|builds]] by configuring the various components of Packer ([[#Builder|builders]], [[#Provisioner|provisioners]]). Packer is able to read a template and use that information to create multiple machine images in parallel.
==Template Engine==
{{External|https://www.packer.io/docs/templates/engine.html}}
==Writing Templates==
{{Internal|Writing Packer Templates|Writing Templates}}
=Variable=


=Builder=
=Builder=
A builder is a Packer component that is able to create a machine image for a single platform. The builder reads in configuration and uses that to run and generate a machine image. A builder is invoked as part of a [[#Build|build]] to create the actual resulting images. Builders can be created and added to Packer in the form of plugins. VirtualBox, VMware, and Amazon EC2 are builders. An example of AWS builder is [[#amazon-ebs|amazon-ebs]].
==docker==
==AMI Builders==
===amazon-ebs===
{{Internal|Packer amazon-ebs Configuration|amazon-ebs}}
=Provisioner=
Provisioners are components of Packer that install and configure software within a running machine prior to that machine being turned into a static image. They perform the major work of making the image contain useful software. Provisioners include shell scripts, Chef, Puppet, etc. Provisioners are implemented as built in methods or executors of some third party software. They install and configure the machine image after the image has booted. A provisioner prepares the system for use by:
* patching the kernel
* installing patches
* creating users
==Available Provisioners==
===file===
{{Internal|Packer file Provisioner|Packer file Provisioner}}
===shell===
{{Internal|Packer shell Provisioner|Packer shell Provisioner}}
===ansible-local===
{{Internal|Packer ansible-local Provisioner|Packer ansible-local Provisioner}}
=Build=
{{External|https://learn.hashicorp.com/tutorials/packer/docker-get-started-build-image}}
A build is a single task that eventually produces an image for a single platform. Multiple builds run in parallel.
A complete build process consists in the following sequence:
* [[Writing Packer Templates|Define a HCL template]] for the image.
=Post-Processor=
Post-processors are components of Packer that take the result of a builder or another post-processor and process that to create a new artifact. Examples of post-processors are compress to compress artifacts, upload to upload artifacts, etc.
=Command=
Commands are sub-commands for the Packer program that perform some job. An example command is "build", which is invoked as <code>packer build</code>. Packer ships with a set of commands out of the box in order to define its command-line interface.
=Networking Considerations=
* <span id='Public_Subnet_Considerations'>[[Packer_Operations#Public_Subnet_Considerations|Packer Operations &#124; Public Subnet Considerations]]
* <span id='Pre-defined_Public_IP_Address_Considerations'>[[Packer_Operations#Pre-defined_Public_IP_Address_Considerations|Packer Operations &#124; Pre-defined_Public_IP_Address_Considerations]]

Latest revision as of 01:08, 4 June 2021

External

Internal

Artifact

An artifact is the result of a single build, and it is usually a set of IDs or a file to represent a machine image. Every builder produces a single artifact. In the case of the Amazon EC2 builder, the artifact is a set of AMI IDs (one per region). For the VMware builder, the artifact is a directory of files comprising the created virtual machine.

Template

Templates are JSON files which define one or more builds by configuring the various components of Packer (builders, provisioners). Packer is able to read a template and use that information to create multiple machine images in parallel.

Template Engine

https://www.packer.io/docs/templates/engine.html

Writing Templates

Writing Templates

Variable

Builder

A builder is a Packer component that is able to create a machine image for a single platform. The builder reads in configuration and uses that to run and generate a machine image. A builder is invoked as part of a build to create the actual resulting images. Builders can be created and added to Packer in the form of plugins. VirtualBox, VMware, and Amazon EC2 are builders. An example of AWS builder is amazon-ebs.

docker

AMI Builders

amazon-ebs

amazon-ebs

Provisioner

Provisioners are components of Packer that install and configure software within a running machine prior to that machine being turned into a static image. They perform the major work of making the image contain useful software. Provisioners include shell scripts, Chef, Puppet, etc. Provisioners are implemented as built in methods or executors of some third party software. They install and configure the machine image after the image has booted. A provisioner prepares the system for use by:

  • patching the kernel
  • installing patches
  • creating users

Available Provisioners

file

Packer file Provisioner

shell

Packer shell Provisioner

ansible-local

Packer ansible-local Provisioner

Build

https://learn.hashicorp.com/tutorials/packer/docker-get-started-build-image

A build is a single task that eventually produces an image for a single platform. Multiple builds run in parallel.

A complete build process consists in the following sequence:

Post-Processor

Post-processors are components of Packer that take the result of a builder or another post-processor and process that to create a new artifact. Examples of post-processors are compress to compress artifacts, upload to upload artifacts, etc.

Command

Commands are sub-commands for the Packer program that perform some job. An example command is "build", which is invoked as packer build. Packer ships with a set of commands out of the box in order to define its command-line interface.

Networking Considerations