Add proper qemu-caching for source image
* Require command at slaves:
'mkdir -p "${HOME}/packer_images_cache/"'
since packer not able to do it.
* set SALT_STOPSTART_WAIT=10 for salt bootstrap
* Dd iptables to base installation
Change-Id: Icc5a50a21e848b93660aa80483b6fdd3e27de243
diff --git a/ubuntu-16.04/run.example.sh b/ubuntu-16.04/run.example.sh
new file mode 100644
index 0000000..df58f50
--- /dev/null
+++ b/ubuntu-16.04/run.example.sh
@@ -0,0 +1,28 @@
+#!/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://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/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:
+cloud-localds --hostname ubuntu --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/
+
diff --git a/ubuntu-16.04/template.json b/ubuntu-16.04/template.json
index 84e1a59..284237e 100644
--- a/ubuntu-16.04/template.json
+++ b/ubuntu-16.04/template.json
@@ -4,6 +4,7 @@
"password": "ho5uo7Uome5d",
"distro": "ubuntu-16-04-x64",
"disk_size": "8000",
+ "images_cache": "{{ env `PACKER_IMAGES_CACHE` }}",
"ubuntu_baseurl": "https://mirror.mirantis.com/proposed/ubuntu/",
"saltstack_gpg": "{{ env `SALTSTACK_GPG` }}",
"saltstack_repo": "{{ env `SALTSTACK_REPO` }}",
@@ -284,6 +285,7 @@
"iso_checksum": "566efef1d6f12e7d3a994c2405bdb642",
"iso_checksum_type": "md5",
"iso_url": "http://cloud-images.ubuntu.com/releases/xenial/release-20180306/ubuntu-16.04-server-cloudimg-amd64-disk1.img",
+ "iso_target_path": "{{ user `images_cache`}}/release-20180306_xenial-server-cloudimg-amd64-disk1.img",
"disk_image": true,
"disk_compression": true,
"accelerator": "kvm",
diff --git a/ubuntu-16.04/template.json.env b/ubuntu-16.04/template.json.env
index 12be33e..ed6351e 100644
--- a/ubuntu-16.04/template.json.env
+++ b/ubuntu-16.04/template.json.env
@@ -1,5 +1,7 @@
# Env variables and description:
-DO_API_TOKEN
+#DO_API_TOKEN
+PACKER_IMAGES_CACHE="${HOME}/packer_images_cache/"
+
# base.sh
UBUNTU_BASEURL=http://mirror.mirantis.com/stable/ubuntu/