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/day01-image/run.example.sh b/day01-image/run.example.sh
index aeee71e..25efd13 100755
--- a/day01-image/run.example.sh
+++ b/day01-image/run.example.sh
@@ -21,14 +21,17 @@
export FORMULA_VERSION=proposed
export BINARY_MCP_VERSION=proposed
export UBUNTU_BASEURL="http://mirror.mirantis.com/proposed/ubuntu/"
-export SALTSTACK_REPO="http://mirror.mirantis.com/proposed/saltstack-2016.3/xenial xenial main"
+export SALTSTACK_REPO="http://mirror.mirantis.com/proposed/saltstack-2017.7/xenial xenial main"
export APT_MIRANTIS_GPG="http://apt.mirantis.com/public.gpg"
-export SALTSTACK_GPG="https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3/SALTSTACK-GPG-KEY.pub"
+export SALTSTACK_GPG="https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/SALTSTACK-GPG-KEY.pub"
export APT_MIRANTIS_SALT_REPO="http://apt.mirantis.com/xenial/ proposed salt"
export GIT_SALT_FORMULAS_SCRIPTS=https://github.com/salt-formulas/salt-formulas-scripts.git
export APT_REPOSITORY="deb [arch=amd64] http://apt.mirantis.com/xenial/ proposed salt"
export APT_REPOSITORY_GPG=http://apt.mirantis.com/public.gpg
###
+# 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:
diff --git a/day01-image/scripts/cleanup.sh b/day01-image/scripts/cleanup.sh
index 2b5ccbc..9f745f9 100644
--- a/day01-image/scripts/cleanup.sh
+++ b/day01-image/scripts/cleanup.sh
@@ -42,7 +42,7 @@
# stop and disable services, for healthy zerodisk
# They should be enabled after cfg01 init
-stop_services="postgresql.service salt-api salt-master salt-minion jenkins maas-rackd.service maas-regiond.service"
+stop_services="postgresql.service salt-api salt-master salt-minion jenkins maas-rackd.service maas-regiond.service bind9"
for s in ${stop_services} ; do
systemctl stop ${s} || true
systemctl disable ${s} || true
diff --git a/day01-image/scripts/salt.sh b/day01-image/scripts/salt.sh
index 78cdd79..a49b274 100644
--- a/day01-image/scripts/salt.sh
+++ b/day01-image/scripts/salt.sh
@@ -17,6 +17,7 @@
salt-call ${SALT_OPTS} state.sls linux.network
salt-call ${SALT_OPTS} state.sls openssh
salt-call ${SALT_OPTS} state.sls git.server
+sleep 99h || true
salt-call ${SALT_OPTS} state.sls postgresql
# install only MAAS packages, don't configure anything.
# Configuration will be processed during cfg01 initialization.
diff --git a/day01-image/template.json b/day01-image/template.json
index 1406680..c4ff8de 100644
--- a/day01-image/template.json
+++ b/day01-image/template.json
@@ -2,6 +2,8 @@
"variables": {
"user": "root",
"password": "r00tme",
+ "images_cache": "{{ env `PACKER_IMAGES_CACHE` }}",
+ "disk_size": "50000",
"do_api_token": "{{ env `DO_API_TOKEN` }}",
"image_name": "{{ env `IMAGE_NAME` }}",
"cluster_model": "{{ env `CLUSTER_MODEL` }}",
@@ -17,8 +19,7 @@
"apt_mirantis_salt_repo": "{{ env `APT_MIRANTIS_SALT_REPO` }}",
"git_salt_formulas_scripts": "{{ env `GIT_SALT_FORMULAS_SCRIPTS` }}",
"apt_repository": "{{ env `APT_REPOSITORY` }}",
- "apt_repository_gpg": "{{ env `APT_REPOSITORY_GPG` }}",
- "disk_size": "50000"
+ "apt_repository_gpg": "{{ env `APT_REPOSITORY_GPG` }}"
},
"provisioners": [
@@ -125,6 +126,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,
"accelerator": "kvm",
"disk_size": "{{ user `disk_size`}}",
diff --git a/day01-image/template.json.env b/day01-image/template.json.env
new file mode 100644
index 0000000..fb05cc3
--- /dev/null
+++ b/day01-image/template.json.env
@@ -0,0 +1 @@
+PACKER_IMAGES_CACHE="${HOME}/packer_images_cache/"