azvyagintsev | 9a1737f | 2019-03-11 15:44:54 +0200 | [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-18-04-x64" |
| 15 | export MIRROR_HOSTNAME="mirror.mirantis.com" |
| 16 | export MIRROR_DIRECTORY="/testing/ubuntu/" |
| 17 | |
| 18 | #export SALTSTACK_REPO="deb [arch=amd64] http://mirror.mirantis.com/proposed/saltstack-2017.7/xenial xenial main" |
| 19 | #export SALTSTACK_GPG="https://mirror.mirantis.com/proposed/saltstack-2017.7/trusty/SALTSTACK-GPG-KEY.pub" |
| 20 | export SALTSTACK_REPO="deb [arch=amd64] http://repo.saltstack.com/apt/ubuntu/18.04/amd64/2017.7/ bionic main" |
| 21 | export SALTSTACK_GPG="http://repo.saltstack.com/apt/ubuntu/18.04/amd64/2017.7/SALTSTACK-GPG-KEY.pub" |
| 22 | ### |
| 23 | # Hard-coded folder in template |
| 24 | export PACKER_IMAGES_CACHE="${HOME}/packer_images_cache/" |
| 25 | mkdir -p "${PACKER_IMAGES_CACHE}" |
| 26 | |
| 27 | export PACKER_KEY_INTERVAL='10ms' |
| 28 | export PACKER_LOG=1 |
| 29 | # For qemu test-build: |
| 30 | [ -f config-drive/cloudata.iso ] && rm -v config-drive/cloudata.iso |
| 31 | mkisofs -o config-drive/cloudata.iso -V cidata -r -J --quiet config-drive |
| 32 | # For qemu test-build: |
| 33 | /home/alexz/bin/packer build -machine-readable -only=qemu -parallel=false -on-error=ask template.json |
| 34 | #rm -rf ~/.packer.d/ |
| 35 | |