| #!/bin/bash |
| |
| # pre-requirments: |
| # apt-get install cloud-localds |
| # Cloudimg: wget https://cloud-images.ubuntu.com/xenial/XXXX/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="ubuntu-16-04-x64" |
| export UBUNTU_BASEURL="http://mirror.mirantis.com/proposed/ubuntu/" |
| export SALTSTACK_REPO="deb [arch=amd64] http://mirror.mirantis.com/proposed/saltstack-2017.7/xenial xenial main" |
| export SALTSTACK_GPG="https://mirror.mirantis.com/proposed/saltstack-2017.7/trusty/SALTSTACK-GPG-KEY.pub" |
| ### |
| # Hard-coded folder in template |
| export PACKER_IMAGES_CACHE="${HOME}/packer_images_cache/" |
| mkdir -p "${PACKER_IMAGES_CACHE}" |
| |
| export PACKER_LOG=1 |
| # For qemu test-build: |
| [ -f config-drive/cloudata.iso ] && rm -v config-drive/cloudata.iso |
| mkisofs -o config-drive/cloudata.iso -V cidata -r -J --quiet config-drive |
| # For qemu test-build: |
| packer build -machine-readable -only=qemu -parallel=false -on-error=ask template.json |
| #rm -rf ~/.packer.d/ |
| |