22.36. packer-builder - Packer Builder Images¶
The following documentation is for Packer Builder Images (packer-builder) content package at version v4.12.0-alpha00.78+gc037aaa40eb3ad853690ce178f9ab8a5bae4c436.
22.36.1. Object Specific Documentation¶
The content package provides the following params.
Defines the image build to run on the packer builder system.
There is no default value specified, if this Param is not set to a value, no image builds will be completed.
- !!! warning
[Read the gitlab repo status](https://gitlab.com/rackn/provision-content/tree/v4/packer-builder/packer/STATUS.md) file for details on builds that have been verified working. This is a changing list as the packer build images are tested.
The list of available builds in the Makefile are as follows:
Specify the git branch to checkout for the Packer contents - useful for debugging when building / testing content not fully checked out in the git repo.
Default value is v4 for the branch.
Defines the supported hypervisor to deploy for the Packer images to be built by.
The default value is kvm.
The currently tested and automated hyperviser deployment is KVM on either CentOS or Ubuntu platforms. Other close linux distro variantes may also work, but have not been tested.
The Packer JSON builds support KVM (libvirt), VirtualBox, and vSphere. Building images can be done utilizing this content pack for other hypervisor versions if the operator sets up the hypervisor by hand first.
The list of Packer JSON supported hypervisor build environments is below. Note that this list has not been extensively tested, and debugging of various hypervisor configuraions may be required if you use anything except kvm type.
This Param, if it has a value set, will allow the operator to pass a custom make command invocation in to the packer builder system. This allows for easier execution/run of builds with unique options or values set to affect the Makefile build tartet runs.
An example valid make command is as follows:
TMPDIR=$(pwd)/tmp PACKER_OPTIONS=”-var-file=variables.json” PACKER_LOG=1 make build-windows-10-1909-libvirt
The packer builder system will add this param to the Machine when it completes the image build process. The image will be uploaded to DRP in the Files space under:
If a value is set for this Param, the Packer build will use this file as the variables override. If this is not set, then the default of variables.json in the packer directory will be used.
- !!! warning
To utilize a custom variables set of values, the operator must first render or make available the JSON variables file on the system that the content will run on.
Example value for this Param: /tmp/variables.json
The file specified must be in valid JSON format. You may specify only the specifc build variables that you wish to override, otherwise, the embedded Variable references in each target build will take precedence.
An example of valid JSON format for setting variables is below (this is an example of the files content that should be rendered for use on the system):
- !!! note
The above example may not be the most up to date set of variables that are available to override in the JSON files. Please see the file named variables.json in the packer directory for more recent options.
Most notably - the output_directory and complete_directory should be located on a filesystem with sufficient space for the builds. Windows builds can take MASSIVE GOBS of disk space - basically plan for a minimum of 4x the disk_size variable setting to be completely safe.
This param specifies the base working directory for all of the Image Build activitiy to be hosted from.
The default location is /builder.
- !!! warning
This directory must be on a filesystem with sufficient space for the builds that need to be performed.
The content package provides the following stages.
This Stage installs prerequisite tools and installs the Hypervisor as defined by the packer-builder/hypervisor Param value. By default this will be the KVM/Libvirt/Qemu build solution.
This stage uploads an image that is specified in the Param named packer-builder/upload-image, to the DRP endpoint. This is typically used after the packer-builder-build-image Stage to push the image to DPR for deployment by the Image Deploy plugin.
The content package provides the following tasks.
Starts the Packer Builder image build for a given build target. The Build target is specified by the packer-builder/build-image param setting.
Performs a git checkout of the packer-builder/packer/ directory in the digitalrebar/provision-content repo.
The git repo directory will be checked out in the packer-builder/packer/ directory on the Machine this is run from.
Installs the hypervisor for the packer builder image builds.
Installs Packer, Packer Plugins, Vagrant, and other required tools on the target platform in preparation of the image builds.
The param packer-builder/upload-image gets set with a list of built images that are finalized and ready for Image Deploy via DRP.
Uploads it to the Digital Rebar Files service location. If an image exists at the specified path, it’ll be overwritten.
The content package provides the following workflows.
This workflow only attempts to perform an image build on the target machine, according to the packer-builder/build-image Param define build target.
- !!! warning
It is assumed the remote Machine that is running this content has already been prepared, hypervisor installed, and the Packer Builder packer JSON config and components cloned in place already.
This workflow prepares a CentOS or Ubuntu target system with tooling for Packer and installs a Hypervisor to perform image builds. An image build will be started based on the packer-builder/build-image Param value.
This workflow prepares a CentOS or Ubuntu target system with tooling for Packer and installs a Hypervisor to perform image builds.
No image build process is started.
This workflow only uploads the image that was built, and has been recorded in the packer-builder/upload-image param, to the DRP Files space.