/packer-templates

Packer Templates

Primary LanguageShellOtherNOASSERTION

Packer Templates

This repository generates Packer templates for building virtual machines.

Requirements

In order to use this repository your system requires the following:

build.sh

Using jq this script manipulates fragments of JSON into a complete template before feeding it to packer. The following environment variables control what's built:

  • OS: Corresponds to the operating system template in os, can be centos or ubuntu.
  • OS_RELEASE: Corresponds to the operating system release used, e.g., 7.5 for CentOS or bionic for Ubuntu.
  • POST_PROCESSOR: The post-processor to use:
    • vagrant: This is the default, creates a Vagrant box in the output directory.
    • vagrant-cloud: Creates a vagrant box and uploads it Vagrant Cloud.
    • amazon-import: Creates an OVA that is imported as an AMI using the AWS VM Import service.
  • PROVISIONER: The provisioner installs additional software:
    • default: The default provisioner does nothing.
    • hoot: Prepares the host with packages necessary to install and test Hootenanny.

Any additional command-line arguments are passed directly to packer which is useful for customization of user variables. For example:

OS=ubuntu ./build.sh \
  -var 'vm_name=bionic' \
  -var 'headless=true' \
  -var 'disk_size=81920' \
  -var-file ~/my-variables.json

release.sh

This script is a wrapper for build.sh that automatically sets up proper variables for the release versions of Hootenanny Vagrant Cloud boxes. Examples are provided below of how this repository was used to generate the specific boxes. All examples assume proper AWS and Vagrant Cloud credentials are in the environment:

export AWS_ACCESS_KEY_ID=AAAABBBBCCCC
export AWS_SECRET_ACCESS_KEY=secret
export AWS_SESSION_TOKEN=AAAABBBBCCCC
export VAGRANT_CLOUD_TOKEN=AAABBBCCC

AWS credentials must satisfy Amazon's VM Import/Export Requirements.

hoot/centos7-minimal

./release.sh -n centos7-minimal -i my-bucket

hoot/trusty-minimal

./release.sh -n trusty-minimal -i my-bucket