azvyagintsev | 0f697cf | 2018-06-22 11:44:13 +0300 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # pre-requirments: |
| 4 | # apt-get install cloud-localds |
| 5 | # Cloudimg: wget https://cloud-images.ubuntu.com/xenial/XXXX/xenial-server-cloudimg-amd64-disk1.img |
| 6 | # Packer: https://releases.hashicorp.com/packer/1.1.3/packer_1.1.3_linux_amd64.zip |
| 7 | |
| 8 | # Those script - only example for variables, which should be passed to packer and |
| 9 | # overwrite variables under /scripts/ directory |
| 10 | |
| 11 | # External script sources: |
| 12 | # http/bootstrap.saltstack.com.sh https://github.com/saltstack/salt-bootstrap |
| 13 | # |
| 14 | export IMAGE_NAME="ubuntu-16-04-x64" |
| 15 | export UBUNTU_BASEURL="http://mirror.mirantis.com/proposed/ubuntu/" |
| 16 | export SALTSTACK_REPO="deb [arch=amd64] http://mirror.mirantis.com/proposed/saltstack-2017.7/xenial xenial main" |
azvyagintsev | dd13784 | 2018-07-13 18:13:06 +0300 | [diff] [blame] | 17 | export SALTSTACK_GPG="https://mirror.mirantis.com/proposed/saltstack-2017.7/trusty/SALTSTACK-GPG-KEY.pub" |
azvyagintsev | 0f697cf | 2018-06-22 11:44:13 +0300 | [diff] [blame] | 18 | ### |
| 19 | # Hard-coded folder in template |
| 20 | export PACKER_IMAGES_CACHE="${HOME}/packer_images_cache/" |
| 21 | mkdir -p "${PACKER_IMAGES_CACHE}" |
| 22 | |
| 23 | export PACKER_LOG=1 |
| 24 | # For qemu test-build: |
azvyagintsev | 045d9e5 | 2018-12-05 14:24:36 +0200 | [diff] [blame] | 25 | [ -f config-drive/cloudata.iso ] && rm -v config-drive/cloudata.iso |
| 26 | mkisofs -o config-drive/cloudata.iso -V cidata -r -J --quiet config-drive |
| 27 | # For qemu test-build: |
azvyagintsev | e052fbe | 2018-12-13 22:08:32 +0200 | [diff] [blame^] | 28 | packer build -machine-readable -only=qemu -parallel=false -on-error=ask template.json |
azvyagintsev | 0f697cf | 2018-06-22 11:44:13 +0300 | [diff] [blame] | 29 | #rm -rf ~/.packer.d/ |
| 30 | |