#!/bin/bash | |
set -ex | |
export ENVIRONMENT=${ENVIRONMENT:-'23.3'} | |
source env/${ENVIRONMENT}.sh | |
export VM_NAME=${VM_NAME:-"${ENVIRONMENT}-amd64-$(date +"%Y%m%d%H%M%S").qcow2"} | |
export PACKER_LOG=1 | |
export PACKER_IMAGES_CACHE="./packer_images_cache" | |
mkdir -p "${PACKER_IMAGES_CACHE}" | |
PACKER_BINARY=${PACKER_BINARY:-"$(which packer)"} | |
./config_drive.sh | |
$PACKER_BINARY build -on-error=cleanup template.json |