Packer Flashcards
Packer
Identical machine image creator. Capable of multi-platform image creation. Not a configuration manager, instead in parallel of managers.
Packer templates
JSON files, portable, static, RW, human and machine editable.
builders: kind of image: avi, docker, both?
Description
Min_packer_version
Post-processor: tagging docker image, publishing.
Provisioners: how to configure image. Puppet, Chef, Ansible, shell scripts.
Variables: Key Value pairs consumed in template.
packer build
Runs all in order, generates set of artifacts given template.
fix: finds backwards incompatible parts, brings them up to date if possible.
inspect: Reads template and outputs various components template defines.
validate: checks syntax, configuration.
Provisioners
Install and configure image after booting.
Ansible: Local, remote Ansible on guest, playbooks.
Chef: Solo ( local execution, requires uploading of cookbooks. ) or Server ( Chef Client ).
File: upload files.
PowerShell:
Puppet:
Shell:
Cloud Init
Frequently used package with Packer, python scripts handling cloud initialization. Can be used to set default locale, instance host name, instance ssh key generation, adding ssh to user’s .ssh/authorized-keys.
Installed on Ubuntu Cloud Images, EC2, Azure, GCE.
Also on Red Hat, Debian.
cloud-init init
Performs initial modules.
module: Activate modules with configuration key.
single: runs single module.
dhclient-hook: runs the dhclient hook to record network info.
features: lists defined features.
analyze: Analyzes logs and data.
devel: runs developer tools.
collect-logs: collets and tar all cloud-init debug info.
clean: remove logs and artifacts to rerun
status: reports cloud-init status or wait on completion.
User-Data Script
Cloud-init.
Typically used to execute shell script.
Begins as #! or Content-Type: text/x-shellscript
Include File
Cloud-init
Include file
Begin as #include or Content-Type: text/x-include-url
Cloud Config Data
Cloud Init
Simplest way to accomplish some things via user-data. Cloud-config syntax, can specify certain things in human-friendly format.
Begin as #cloud-config or Content-Type: text/cloud-config
Upstart Job
Cloud Init
Content placed into file in /etc/init and will be consumed by upstart as any other upstart job.
As #upstart-job or Content-Type: text/upstart-job
Cloud Boothook
Cloud Init
boothook data. Stored in file under /var/lib/cloud and executed immediately.
Begin as #cloud-boothook or Content-Type: text/cloud-boothook
Part Hander
Cloud Init
Contains custom code for either supporting new mime-types in multi-part user data or overriding existing handlers for supported mime-types.
Begin as #part-handler or Content-Type: text/part-handler
Format example:
#!/bin/sh echo “Hello World”