blob: f1d39be1f0f888413c2675df4f8a8d2622eeb09d [file] [log] [blame]
#!/bin/bash
# pre-requirments:
# apt-get install cloud-localds
# Cloudimg: wget https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
# Packer: https://releases.hashicorp.com/packer/1.1.3/packer_1.1.3_linux_amd64.zip
# Those script - only example for variables, which should be passed to packer and
# overwrite variables under /scripts/ directory
# External script sources:
# http/bootstrap.saltstack.com.sh https://github.com/saltstack/salt-bootstrap
#
export IMAGE_NAME="mcp-offline-mirror-$(date '+%Y-%m-%d-%H-%M-%S')"
export PACKER_IMAGES_CACHE="${HOME}/packer_images_cache/"
#
export CLUSTER_MODEL="https://github.com/Mirantis/mcp-offline-model.git"
export CLUSTER_MODEL_REF="master"
export CLUSTER_NAME="mcp-offline"
export MCP_VERSION="proposed"
export FORMULA_VERSION="proposed"
BINARY_MCP_VERSION="proposed"
export UBUNTU_BASEURL="http://mirror.mirantis.com/${BINARY_MCP_VERSION}/ubuntu/"
export SALTSTACK_REPO="http://mirror.mirantis.com/${BINARY_MCP_VERSION}/saltstack-2017.7/xenial xenial main"
export SALTSTACK_GPG="http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/SALTSTACK-GPG-KEY.pub"
export APT_MIRANTIS_GPG="http://apt.mirantis.com/public.gpg"
export APT_MIRANTIS_SALT_REPO="http://apt.mirantis.com/xenial/ ${BINARY_MCP_VERSION} salt "
#
export GIT_SALT_FORMULAS_SCRIPTS="https://github.com/salt-formulas/salt-formulas-scripts.git"
#
export APT_REPOSITORY=" deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO} "
export APT_REPOSITORY_GPG=${APT_MIRANTIS_GPG}
# Openstack-related variables
#export VM_FLAVOR="3c4fe514-3eb6-464d-a419-7be09d72cf1e"
#export VM_FLOATING_IP_POOL="095f43ed-65ba-48ce-8185-d4080e430a88"
#export IMAGE_NAME="mcp-offline-mirror-$(date '+%Y-%m-%d-%H-%M-%S')"
#export VM_IMAGE="9953a40d-1fa2-4f26-b146-0507dbc912dc" # ubuntu cloud img
# May be need, if cloud with keystone v3 used
#export OS_TENANT_ID=$OS_PROJECT_ID
#export OS_DOMAIN_NAME="xxxx"
#export OS_TENANT_NAME="xxxxx"
# Hard-coded folder in template
mkdir -p "${PACKER_IMAGES_CACHE}"
export PACKER_LOG=1
# For qemu test-build:
cloud-localds --hostname apt01 --dsmode local config-drive/cloudata.iso config-drive/user-data.yaml
packer build -only=qemu -parallel=false -on-error=ask template.json
# rm -rf ~/.packer.d/