packer

Packer Project :

Builders :

There are many builder plugins - this project will look only at virtualbox and vmware

Environment

Project

cd packer

$packer validate templates/rhel8/gold.pkr.hcl

$packer fmt templates/rhel8/gold.pkr.hcl

$update-gold-md5 (Get the ISO md5)

$packer build templates/rhel8/gold.pkr.hcl

$revert-md5-placeholder (Remove the ISO md5)

Usage

For convenience - added small noddy script to clean up the info.json and gold.pkr.hcl before and after builds

$create-packer-iso <format|validate|build|force>

Running packer build will create a build folder containing both an OVF and a VMDK and also output a Vagrant BOX file.

image

Right click on the OVF and Open-With either Virtualbox or VMware Workstation Player to import and create new VMs

image

image

Edit any settings cush as the VM name then select ‘Finish’ and wait for the ‘Importing appliance …’ process to complete which will build a new VM in a powered off state.

image

Even though this Packer template has not yet created a vmware image - we can still import the OVF into VMware Workstation Player - you will be prompted to set a name and the location. When ready hit the ‘Import’ button and wait. Unlike VirtualBox these VMs will be created in a powered on state.

image

You may see this prompt - just hit ‘Retry’ and the image will be imported and VMs created.

image

Example

This is what the packer build process looks like…

$packer build templates/rhel8/gold.pkr.hcl

image image

Using the BOX with Vagrant

You may now ADD the Vagrant BOX and procede as per Vagrant instructions.