Merge "packer-image-buid updates"
diff --git a/ubuntu-16.04/http/preseed.cfg b/common/files/legacy/http/preseed.cfg
similarity index 100%
rename from ubuntu-16.04/http/preseed.cfg
rename to common/files/legacy/http/preseed.cfg
diff --git a/common/ubuntu_base.sh b/common/ubuntu_base.sh
index 336662b..10f42c0 100644
--- a/common/ubuntu_base.sh
+++ b/common/ubuntu_base.sh
@@ -1,6 +1,7 @@
#!/bin/bash -xe
-if [ -f /tmp/done_ubuntu_base ] ; then
+# Don't use /tmp/ - some templates do node reboot
+if [ -f /done_ubuntu_base ] ; then
echo "INFO: ubuntu_base already finished.Skipping.."
exit 0
fi
@@ -27,10 +28,10 @@
sysctl -w fs.file-max=100000
# Overwrite default mirrors
-echo "deb [arch=amd64] ${UBUNTU_BASEURL} xenial main restricted multiverse universe" > /etc/apt/sources.list
-echo "deb [arch=amd64] ${UBUNTU_BASEURL} xenial-updates main restricted multiverse universe" >> /etc/apt/sources.list
-echo "deb [arch=amd64] ${UBUNTU_BASEURL} xenial-security main restricted multiverse universe" >> /etc/apt/sources.list
-#echo "deb [arch=amd64] ${UBUNTU_BASEURL} xenial-backports main restricted multiverse universe" >> /etc/apt/sources.list
+echo "deb [arch=amd64] ${UBUNTU_BASEURL} xenial main restricted universe" > /etc/apt/sources.list
+echo "deb [arch=amd64] ${UBUNTU_BASEURL} xenial-updates main restricted universe" >> /etc/apt/sources.list
+echo "deb [arch=amd64] ${UBUNTU_BASEURL} xenial-security main restricted universe" >> /etc/apt/sources.list
+#echo "deb [arch=amd64] ${UBUNTU_BASEURL} xenial-backports main restricted universe" >> /etc/apt/sources.list
apt-get clean
apt-get update
@@ -77,4 +78,4 @@
systemctl stop ${s} || true
done
-touch /tmp/done_ubuntu_base
+touch /done_ubuntu_base
diff --git a/common/ubuntu_cleanup.sh b/common/ubuntu_cleanup.sh
index 4eb9c7f..919f64a 100644
--- a/common/ubuntu_cleanup.sh
+++ b/common/ubuntu_cleanup.sh
@@ -2,9 +2,11 @@
apt-get -y autoremove --purge
apt-get -y clean
-rm -rf /var/lib/apt/lists/*
-rm -f /usr/sbin/policy-rc.d || true
+rm -rf /var/lib/apt/lists/*
+rm -rv /etc/apt/sources.list.d/* || true
+echo > /etc/apt/sources.list || true
+rm -vf /usr/sbin/policy-rc.d || true
echo "cleaning up hostname"
sed -i "/.*ubuntu.*/d" /etc/hosts
@@ -15,19 +17,23 @@
echo "cleaning up dhcp leases"
rm -rf /var/lib/dhcp/* || true
-rm -rf /var/lib/ntp/ntp.conf.dhcp || true
+rm -rfv /var/lib/ntp/ntp.conf.dhcp || true
echo "cleaning up udev rules"
-rm -f /etc/udev/rules.d/70-persistent-net.rules || true
+rm -fv /etc/udev/rules.d/70-persistent-net.rules || true
rm -rf /dev/.udev/ || true
-rm -f /lib/udev/rules.d/75-persistent-net-generator.rules || true
+rm -fv /lib/udev/rules.d/75-persistent-net-generator.rules || true
echo "cleaning up minion_id for salt"
-rm -f /etc/salt/minion_id || true
+rm -vf /etc/salt/minion_id || true
echo "cleaning up resolvconf"
sed -i '/172\.18\.208\.44/d' /etc/resolvconf/resolv.conf.d/base
+# Remove flags
+rm -v /done_ubuntu_base || true
+rm -v /done_ubuntu_salt_bootstrap || true
+
# Clear\drop cache's
sync
echo 3 > /proc/sys/vm/drop_caches
diff --git a/common/ubuntu_cleanup_salt.sh b/common/ubuntu_cleanup_salt.sh
new file mode 100644
index 0000000..4e77783
--- /dev/null
+++ b/common/ubuntu_cleanup_salt.sh
@@ -0,0 +1,28 @@
+#!/bin/bash -xe
+
+apt-get purge salt-formula-* -y
+
+echo "removing all previously accepted salt keys"
+salt-key -D -y || true
+
+echo "cleaning up reclass"
+rm -rf /srv/salt/reclass || true
+rm -rf /srv/salt/scripts || true
+rm -rf /usr/share/salt-formulas/env || true
+#
+mkdir -p /srv/salt/reclass/
+mkdir -p /usr/share/salt-formulas/reclass/service/
+mkdir -p /usr/share/salt-formulas/env/
+
+# stop and disable services, for healthy zerodisk
+# They should be enabled after VCP init
+stop_services="salt-api salt-master salt-minion"
+for s in ${stop_services} ; do
+ systemctl stop ${s} || true
+# Enable this, after refactoring salt:control:virtng
+# systemctl disable ${s} || true
+done
+
+# Clear\drop cache's
+sync
+echo 3 > /proc/sys/vm/drop_caches
diff --git a/common/ubuntu_salt_bootstrap.sh b/common/ubuntu_salt_bootstrap.sh
index 0b45762..a5a04f3 100644
--- a/common/ubuntu_salt_bootstrap.sh
+++ b/common/ubuntu_salt_bootstrap.sh
@@ -1,6 +1,6 @@
#!/bin/bash -xe
-if [ -f '/tmp/done_ubuntu_salt_bootstrap' ]; then
+if [ -f '/done_ubuntu_salt_bootstrap' ]; then
echo "INFO: ubuntu_salt_bootstrap already finished! Skipping.."
exit 0
fi
@@ -62,4 +62,4 @@
exit 1
fi
bash -x /srv/salt/scripts/bootstrap.sh || true
-touch /tmp/done_ubuntu_salt_bootstrap
+touch /done_ubuntu_salt_bootstrap
diff --git a/common/ubuntu_trusty_base.sh b/common/ubuntu_trusty_base.sh
new file mode 100644
index 0000000..b065455
--- /dev/null
+++ b/common/ubuntu_trusty_base.sh
@@ -0,0 +1,81 @@
+#!/bin/bash -xe
+
+# Don't use /tmp/ - some templates do node reboot
+if [ -f /done_ubuntu_base ] ; then
+ echo "INFO: ubuntu_base already finished.Skipping.."
+ exit 0
+fi
+
+function prod_21514_wa() {
+ echo 'Apply WA for https://mirantis.jira.com/browse/PROD-20751'
+ echo 'Installing isc-dhcp from xenial'
+ echo "deb [arch=amd64] ${UBUNTU_BASEURL} xenial main restricted universe" > /etc/apt/sources.list.d/xenial.list
+ echo "deb [arch=amd64] ${UBUNTU_BASEURL} xenial-updates main restricted universe" >> /etc/apt/sources.list.d/xenial.list
+ echo "deb [arch=amd64] ${UBUNTU_BASEURL} xenial-security main restricted universe" >> /etc/apt/sources.list.d/xenial.list
+ apt-get update
+ apt-get install -y isc-dhcp-client isc-dhcp-common
+ rm -v /etc/apt/sources.list.d/xenial.list || true
+}
+
+### Body
+UBUNTU_BASEURL="${UBUNTU_BASEURL:-mirror://mirrors.ubuntu.com/mirrors.txt}"
+## Base packages and setup
+export DEBIAN_FRONTEND=noninteractive
+echo -e '#!/bin/sh\nexit 101' > /usr/sbin/policy-rc.d
+chmod +x /usr/sbin/policy-rc.d
+
+# Configure apt. Please refer to
+# https://github.com/Mirantis/reclass-system-salt-model/blob/master/linux/system/single/debian.yml
+# and keep those structures with same naming convention - to prevent
+# misconfiguration between base system and salt state.
+echo "Acquire::CompressionTypes::Order gz;" >/etc/apt/apt.conf.d/99compression-workaround-salt
+echo "Acquire::EnableSrvRecords false;" >/etc/apt/apt.conf.d/99enablesrvrecords-false
+echo "Acquire::http::Pipeline-Depth 0;" > /etc/apt/apt.conf.d/99aws-s3-mirrors-workaround-salt
+echo "APT::Install-Recommends false;" > /etc/apt/apt.conf.d/99dont_install_recommends-salt
+echo "APT::Install-Suggests false;" > /etc/apt/apt.conf.d/99dont_install_suggests-salt
+echo "Acquire::Languages none;" > /etc/apt/apt.conf.d/99dont_acquire_all_languages-salt
+echo "APT::Periodic::Update-Package-Lists 0;" > /etc/apt/apt.conf.d/99dont_update_package_list-salt
+echo "APT::Periodic::Download-Upgradeable-Packages 0;" > /etc/apt/apt.conf.d/99dont_update_download_upg_packages-salt
+echo "APT::Periodic::Unattended-Upgrade 0;" > /etc/apt/apt.conf.d/99disable_unattended_upgrade-salt
+
+sysctl -w fs.file-max=100000
+# Overwrite default mirrors
+echo "deb [arch=amd64] ${UBUNTU_BASEURL} trusty main restricted universe" > /etc/apt/sources.list
+echo "deb [arch=amd64] ${UBUNTU_BASEURL} trusty-updates main restricted universe" >> /etc/apt/sources.list
+echo "deb [arch=amd64] ${UBUNTU_BASEURL} trusty-security main restricted universe" >> /etc/apt/sources.list
+prod_21514_wa
+apt-get clean
+apt-get update
+
+# Useful tools
+EXTRA_PKGS="byobu curl ethtool iputils-ping lsof strace tcpdump traceroute wget iptables"
+# Pretty tools
+EXTRA_PKGS="${EXTRA_PKGS} byobu htop tmux tree vim-nox mc"
+# Common prerequisites
+EXTRA_PKGS="${EXTRA_PKGS} apt-transport-https libmnl0 python-apt python-m2crypto python-psutil acpid"
+
+# Cleanup old kernels, ensure latest is installed via virtual package
+if [ ! -f /tmp/no_install_kernel ]; then
+ modprobe cpuid
+ apt-get purge -y linux-image-* linux-headers-* | grep -v 'is not installed, so not removed'
+ apt-get install -y linux-image-virtual-lts-xenial linux-image-extra-virtual-lts-xenial
+
+ # Update grub cmdline
+ sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub
+ sed -i 's|GRUB_CMDLINE_LINUX=.*|GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub
+ update-grub
+fi
+apt-get -y upgrade
+apt-get -y dist-upgrade
+
+# Tmux fixes
+cat << 'EOF' >> /etc/tmux.conf
+set -g default-terminal "screen-256color"
+set -g set-titles on
+set -g xterm-keys on
+EOF
+
+# Setup cloud-init
+apt-get -y install cloud-init
+
+touch /done_ubuntu_base
diff --git a/ubuntu-14.04/scripts/security.sh b/common/ubuntu_trusty_security.sh
similarity index 100%
rename from ubuntu-14.04/scripts/security.sh
rename to common/ubuntu_trusty_security.sh
diff --git a/day01-image/scripts/cleanup.sh b/day01-image/scripts/cleanup.sh
deleted file mode 100644
index 0f5adec..0000000
--- a/day01-image/scripts/cleanup.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/bash -xe
-
-apt-get purge salt-formula-* -y
-apt-get -y autoremove --purge
-apt-get -y clean
-
-rm -rf /var/lib/ntp/ntp.conf.dhcp || true
-rm -rf /var/lib/apt/lists/*
-rm -rv /etc/apt/sources.list.d/* || true
-echo > /etc/apt/sources.list || true
-rm -vf /usr/sbin/policy-rc.d || true
-
-
-echo "removeing all previously accepted salt keys"
-salt-key -D -y || true
-
-echo "cleaning up reclass"
-rm -rf /srv/salt/reclass || true
-rm -rf /srv/salt/scripts || true
-rm -rf /usr/share/salt-formulas/env || true
-#
-mkdir -p /srv/salt/reclass/
-mkdir -p /usr/share/salt-formulas/reclass/service/
-mkdir -p /usr/share/salt-formulas/env/
-
-echo "cleaning up hostname"
-sed -i "/.*ubuntu.*/d" /etc/hosts
-sed -i "/.*salt.*/d" /etc/hosts
-
-echo "cleaning up guest additions"
-rm -rf VBoxGuestAdditions_*.iso VBoxGuestAdditions_*.iso.? || true
-
-echo "cleaning up dhcp leases"
-rm -rf /var/lib/dhcp/* || true
-
-echo "cleaning up udev rules"
-rm -f /etc/udev/rules.d/70-persistent-net.rules || true
-rm -rf /dev/.udev/ || true
-rm -f /lib/udev/rules.d/75-persistent-net-generator.rules || true
-
-echo "cleaning up minion_id for salt"
-rm -f /etc/salt/minion_id || true
-
-echo "cleaning up resolvconf"
-sed -i '/172\.18\.208\.44/d' /etc/resolvconf/resolv.conf.d/base
-
-# 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 bind9"
-for s in ${stop_services} ; do
- systemctl stop ${s} || true
- systemctl disable ${s} || true
-done
-
-echo 3 > /proc/sys/vm/drop_caches
-sync
diff --git a/day01-image/scripts/cleanup.sh b/day01-image/scripts/cleanup.sh
new file mode 120000
index 0000000..cf970b6
--- /dev/null
+++ b/day01-image/scripts/cleanup.sh
@@ -0,0 +1 @@
+../../common/ubuntu_cleanup.sh
\ No newline at end of file
diff --git a/day01-image/scripts/cleanup_day01.sh b/day01-image/scripts/cleanup_day01.sh
new file mode 100644
index 0000000..89cd6e7
--- /dev/null
+++ b/day01-image/scripts/cleanup_day01.sh
@@ -0,0 +1,12 @@
+#!/bin/bash -xe
+
+# 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 bind9"
+for s in ${stop_services} ; do
+ systemctl stop ${s} || true
+ systemctl disable ${s} || true
+done
+
+echo 3 > /proc/sys/vm/drop_caches
+sync
diff --git a/day01-image/scripts/cleanup_salt.sh b/day01-image/scripts/cleanup_salt.sh
new file mode 120000
index 0000000..72d6f4e
--- /dev/null
+++ b/day01-image/scripts/cleanup_salt.sh
@@ -0,0 +1 @@
+../../common/ubuntu_cleanup_salt.sh
\ No newline at end of file
diff --git a/day01-image/template.json b/day01-image/template.json
index c4ff8de..0628031 100644
--- a/day01-image/template.json
+++ b/day01-image/template.json
@@ -87,6 +87,8 @@
"scripts": [
"scripts/security.sh",
"scripts/cleanup.sh",
+ "scripts/cleanup_salt.sh",
+ "scripts/cleanup_day01.sh",
"scripts/info.sh",
"scripts/zerodisk.sh"
]
diff --git a/mirror-image/run.example.sh b/mirror-image/run.example.sh
old mode 100644
new mode 100755
index cab6393..eea8081
--- a/mirror-image/run.example.sh
+++ b/mirror-image/run.example.sh
@@ -12,6 +12,7 @@
# http/bootstrap.saltstack.com.sh https://github.com/saltstack/salt-bootstrap
#
+export IMAGE_NAME="mcp-offline-mirror-$(date '+%Y-%m-%d-%H-%M-%S')"
export PACKER_IMAGES_CACHE="${HOME}/packer_images_cache/"
#
export CLUSTER_MODEL="https://github.com/Mirantis/mcp-offline-model.git"
diff --git a/mirror-image/scripts/cleanup_salt.sh b/mirror-image/scripts/cleanup_salt.sh
new file mode 120000
index 0000000..72d6f4e
--- /dev/null
+++ b/mirror-image/scripts/cleanup_salt.sh
@@ -0,0 +1 @@
+../../common/ubuntu_cleanup_salt.sh
\ No newline at end of file
diff --git a/mirror-image/scripts/mirrors.sh b/mirror-image/scripts/mirrors.sh
index 764597a..83499de 100644
--- a/mirror-image/scripts/mirrors.sh
+++ b/mirror-image/scripts/mirrors.sh
@@ -5,11 +5,15 @@
#aptly
# FIXME: remove duplicate run after fix: PROD-21387
# RC: aptly may fail to import gpg key's randomly(most probably,nw issue), so lets run it twice
-salt-call ${SALT_OPTS} state.sls aptly.server || salt-call ${SALT_OPTS} state.sls aptly.server
+salt-call ${SALT_OPTS} state.sls aptly.server || true
+sleep 5
+salt-call ${SALT_OPTS} state.sls aptly.server
salt-call ${SALT_OPTS} state.sls aptly.publisher
-salt-call ${SALT_OPTS} state.sls aptly || salt-call ${SALT_OPTS} state.sls aptly
+salt-call ${SALT_OPTS} state.sls aptly || true
+sleep 5
+salt-call ${SALT_OPTS} state.sls aptly
aptly_mirror_update.sh -sv
-aptly-publisher --url http://10.99.0.1:18084 --timeout=1200 publish -v -d -c /etc/aptly-publisher.yaml --architectures amd64 --recreate --force-overwrite
+aptly-publisher --url http://10.99.0.1:18084 --timeout=1200 publish -v -d -c /etc/aptly/publisher.yaml --architectures amd64 --recreate --force-overwrite
#docker registry
salt-call ${SALT_OPTS} state.sls docker.client.registry
diff --git a/mirror-image/scripts/reboot.sh b/mirror-image/scripts/reboot.sh
index 52adc95..bddc2a9 100644
--- a/mirror-image/scripts/reboot.sh
+++ b/mirror-image/scripts/reboot.sh
@@ -1,2 +1,6 @@
+#!/bin/bash -x
+
+echo 3 > /proc/sys/vm/drop_caches
+sync
pgrep -f "sshd: root@" | xargs kill -9
-reboot now
\ No newline at end of file
+reboot now
diff --git a/mirror-image/scripts/salt.sh b/mirror-image/scripts/salt.sh
index 9655ec0..ea3d147 100644
--- a/mirror-image/scripts/salt.sh
+++ b/mirror-image/scripts/salt.sh
@@ -1,10 +1,11 @@
#!/bin/bash -xe
+# Wait for salt-master and salt-minion to wake up after restart
+# since we just perform 'reboot.sh'
+salt-call --timeout=120 test.ping
+
SALT_OPTS="-l debug -t 10 --retcode-passthrough --no-color"
-echo "deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO}" > /etc/apt/sources.list.d/mcp_salt.list
-apt-get update
-apt-get install salt-formula* -y
salt-call saltutil.refresh_pillar
salt-call saltutil.sync_all
diff --git a/mirror-image/template.json b/mirror-image/template.json
index 5b942d0..6c5f7b5 100644
--- a/mirror-image/template.json
+++ b/mirror-image/template.json
@@ -2,7 +2,7 @@
"variables": {
"user": "root",
"password": "r00tme",
- "disk_size": "100000",
+ "disk_size": "60000",
"images_cache": "{{ env `PACKER_IMAGES_CACHE` }}",
"do_api_token": "{{ env `DO_API_TOKEN` }}",
"image_name": "{{ env `IMAGE_NAME` }}",
@@ -79,7 +79,7 @@
"environment_vars": [
"APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}"
],
- "pause_before": "120s",
+ "pause_before": "60s",
"type": "shell",
"expect_disconnect": "true",
"scripts": [
@@ -92,12 +92,13 @@
"MCP_VERSION={{ user `mcp_version` }}"
],
"type": "shell",
- "pause_before": "120s",
+ "pause_before": "60s",
"scripts": [
"scripts/mirrors.sh",
"scripts/security.sh",
"scripts/info.sh",
"scripts/cleanup.sh",
+ "scripts/cleanup_salt.sh",
"scripts/zerodisk.sh"
]
},
@@ -161,7 +162,7 @@
"headless": true,
"ssh_username": "{{user `user`}}",
"ssh_password": "{{user `password`}}",
- "shutdown_command": "sync ; shutdown -P now",
+ "shutdown_command": "shutdown -P now",
"vnc_bind_address": "0.0.0.0",
"vnc_port_max": "5956",
"vnc_port_min": "5956",
diff --git a/ubuntu-14.04/config-drive/user-data.yaml b/ubuntu-14.04/config-drive/user-data.yaml
new file mode 100644
index 0000000..03ddb4a
--- /dev/null
+++ b/ubuntu-14.04/config-drive/user-data.yaml
@@ -0,0 +1,18 @@
+#cloud-config
+debug: True
+ssh_pwauth: True
+disable_root: false
+chpasswd:
+ list: |
+ root:r00tme
+# cloud-user:ho5uo7Uome5d
+ expire: False
+output: {all: '| tee -a /var/log/cloud-init-output.log'}
+runcmd:
+ - sed -i'.orig' -e's/PermitRootLogin.*/PermitRootLogin yes/g' -e's/PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config
+ - service ssh restart
+# speed up resolving, and not stuck on timeouts. One-shot changes
+ - echo '127.0.0.1 ubuntu' >> /etc/hosts
+ - echo 'options timeout:1 attempts:4' >> /etc/resolv.conf
+ - echo 'nameserver 172.18.208.44' >> /etc/resolvconf/resolv.conf.d/base
+ - resolvconf -u
diff --git a/ubuntu-14.04/configs/cloud/cloud.cfg b/ubuntu-14.04/files/etc/cloud/cloud.cfg
similarity index 97%
rename from ubuntu-14.04/configs/cloud/cloud.cfg
rename to ubuntu-14.04/files/etc/cloud/cloud.cfg
index c3cbb03..94b618d 100644
--- a/ubuntu-14.04/configs/cloud/cloud.cfg
+++ b/ubuntu-14.04/files/etc/cloud/cloud.cfg
@@ -4,6 +4,7 @@
# This will cause the set+update hostname module to not operate (if true)
preserve_hostname: false
+apt_preserve_sources_list: true
# Better let managing of /etc/hosts on salt and others
# manage_etc_hosts: localhost
diff --git a/ubuntu-14.04/configs/cloud/cloud.cfg.d/99_tcp.cfg b/ubuntu-14.04/files/etc/cloud/cloud.cfg.d/99_tcp.cfg
similarity index 92%
rename from ubuntu-14.04/configs/cloud/cloud.cfg.d/99_tcp.cfg
rename to ubuntu-14.04/files/etc/cloud/cloud.cfg.d/99_tcp.cfg
index 2f1b85c..7fbc1c8 100644
--- a/ubuntu-14.04/configs/cloud/cloud.cfg.d/99_tcp.cfg
+++ b/ubuntu-14.04/files/etc/cloud/cloud.cfg.d/99_tcp.cfg
@@ -3,6 +3,7 @@
Ec2:
timeout: 5 # (defaults to 50 seconds)
max_wait: 10 # (defaults to 120 seconds)
+ strict_id: false
OpenStack:
timeout: 5 # (defaults to 50 seconds)
max_wait: 10 # (defaults to 120 seconds)
@@ -10,6 +11,9 @@
timeout: 5 # (defaults to 50 seconds)
max_wait: 10 # (defaults to 120 seconds)
+warnings:
+ dsid_missing_source: off
+
system_info:
# This will affect which distro class gets used
distro: ubuntu
diff --git a/ubuntu-14.04/http/preseed-lvm.cfg b/ubuntu-14.04/http/preseed-lvm.cfg
deleted file mode 100644
index fbaf984..0000000
--- a/ubuntu-14.04/http/preseed-lvm.cfg
+++ /dev/null
@@ -1,68 +0,0 @@
-choose-mirror-bin mirror/http/proxy string
-d-i debian-installer/framebuffer boolean false
-d-i debconf/frontend select noninteractive
-d-i base-installer/kernel/override-image string linux-server
-d-i clock-setup/utc boolean true
-d-i clock-setup/utc-auto boolean true
-d-i finish-install/reboot_in_progress note
-d-i grub-installer/only_debian boolean true
-d-i grub-installer/with_other_os boolean true
-d-i netcfg/get_domain string unassigned-domain
-d-i netcfg/get_hostname string unassigned-hostname
-
-d-i partman-auto/disk string /dev/sda /dev/vda
-d-i partman-auto/method string lvm
-d-i partman-lvm/device_remove_lvm boolean true
-d-i partman-md/device_remove_md boolean true
-d-i partman-lvm/confirm boolean true
-d-i partman-lvm/confirm_nooverwrite boolean true
-
-d-i partman-auto/init_automatically_partition \
- select Guided - use entire disk and set up LVM
-
-d-i partman-auto-lvm/guided_size string max
-d-i partman-auto-lvm/new_vg_name string vg00
-
-d-i partman-auto/expert_recipe string \
- boot-root :: \
- 64 128 256 ext4 \
- $primary{ } $bootable{ } \
- method{ format } format{ } \
- use_filesystem{ } filesystem{ ext4 } \
- mountpoint{ /boot } \
- options/noatime{ noatime } \
- . \
- 128 512 200% linux-swap \
- method{ swap } format{ } $lvmok{ } \
- . \
- 512 512 -1 ext4 \
- method{ format } format{ } $lvmok{ } \
- use_filesystem{ } filesystem{ ext4 } \
- mountpoint{ / } \
- options/noatime{ noatime } \
- . \
-
-d-i partman/default_filesystem string ext4
-
-d-i partman/confirm_write_new_label boolean true
-d-i partman/choose_partition select finish
-d-i partman/confirm boolean true
-d-i partman/confirm_nooverwrite boolean true
-
-d-i pkgsel/include string openssh-server
-d-i pkgsel/install-language-support boolean false
-d-i pkgsel/update-policy select none
-popularity-contest popularity-contest/participate boolean false
-
-d-i pkgsel/upgrade select none
-
-d-i time/zone string UTC
-d-i passwd/root-login boolean true
-d-i passwd/make-user boolean false
-d-i openssh-server/permit-root-login boolean true
-d-i user-setup/allow-password-weak boolean true
-d-i user-setup/encrypt-home boolean false
-tasksel tasksel/first multiselect minimal, ssh-server, openssh-server
-
-d-i preseed/late_command string \
- in-target sed -i 's/PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config
diff --git a/ubuntu-14.04/http/preseed.cfg b/ubuntu-14.04/http/preseed.cfg
deleted file mode 100644
index f6727d3..0000000
--- a/ubuntu-14.04/http/preseed.cfg
+++ /dev/null
@@ -1,48 +0,0 @@
-choose-mirror-bin mirror/http/proxy string
-d-i debian-installer/framebuffer boolean false
-d-i debconf/frontend select noninteractive
-d-i base-installer/kernel/override-image string linux-server
-d-i clock-setup/utc boolean true
-d-i clock-setup/utc-auto boolean true
-d-i finish-install/reboot_in_progress note
-d-i grub-installer/only_debian boolean true
-d-i grub-installer/with_other_os boolean true
-d-i netcfg/get_domain string unassigned-domain
-d-i netcfg/get_hostname string unassigned-hostname
-
-d-i partman-auto/disk string /dev/sda /dev/vda
-d-i partman-auto/method string regular
-d-i partman/choose_partition select finish
-d-i partman/confirm boolean true
-d-i partman/confirm_nooverwrite boolean true
-d-i partman/confirm_write_new_label boolean true
-d-i partman-basicfilesystems/no_swap boolean false
-d-i partman-auto/choose_recipe select boot-root
-
-d-i partman-auto/expert_recipe string \
- boot-root :: \
- 512 512 -1 ext4 \
- $primary{ } $bootable{ } \
- method{ format } format{ } \
- use_filesystem{ } filesystem{ ext4 } \
- mountpoint{ / } \
- options/noatime{ noatime } \
- . \
-
-d-i pkgsel/include string openssh-server
-d-i pkgsel/install-language-support boolean false
-d-i pkgsel/update-policy select none
-popularity-contest popularity-contest/participate boolean false
-
-d-i pkgsel/upgrade select none
-
-d-i time/zone string UTC
-d-i passwd/root-login boolean true
-d-i passwd/make-user boolean false
-d-i openssh-server/permit-root-login boolean true
-d-i user-setup/allow-password-weak boolean true
-d-i user-setup/encrypt-home boolean false
-tasksel tasksel/first multiselect minimal, ssh-server, openssh-server
-
-d-i preseed/late_command string \
- in-target sed -i 's/PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config
diff --git a/ubuntu-14.04/run.example.sh b/ubuntu-14.04/run.example.sh
new file mode 100755
index 0000000..2bc0641
--- /dev/null
+++ b/ubuntu-14.04/run.example.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# pre-requirments:
+# apt-get install cloud-localds
+# Cloudimg: wget https://cloud-images.ubuntu.com/trusty/XXXX/trusty-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-14-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/trusty trusty main"
+export SALTSTACK_GPG="http://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:
+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-14.04/scripts/base.sh b/ubuntu-14.04/scripts/base.sh
deleted file mode 100644
index 439c5a4..0000000
--- a/ubuntu-14.04/scripts/base.sh
+++ /dev/null
@@ -1,70 +0,0 @@
-## Base packages and setup
-export DEBIAN_FRONTEND=noninteractive
-echo "exit 101" > /usr/sbin/policy-rc.d
-chmod +x /usr/sbin/policy-rc.d
-
-echo "Acquire::CompressionTypes::Order gz;" >/etc/apt/apt.conf.d/99compression-workaround-salt
-
-# Overwrite default mirrors
-echo "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty main restricted multiverse universe" > /etc/apt/sources.list
-echo "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-updates main restricted multiverse universe" >> /etc/apt/sources.list
-echo "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-security main restricted multiverse universe" >> /etc/apt/sources.list
-echo "deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-backports main restricted multiverse universe" >> /etc/apt/sources.list
-
-# Add apt repository
-echo "deb [arch=amd64] http://apt.mirantis.com/trusty/ nightly salt" > /etc/apt/sources.list.d/mcp_salt.list
-echo "deb [arch=amd64] http://apt.mirantis.com/trusty/ nightly extra" > /etc/apt/sources.list.d/mcp_extra.list
-curl -sf http://apt.mirantis.com/public.gpg | apt-key add -
-
-apt-get clean
-apt-get update
-
-# Useful tools
-apt-get -y install byobu curl ethtool htop iputils-ping lsof strace tcpdump tmux traceroute tree vim-nox wget
-# Install common prerequisites
-apt-get -y install apt-transport-https libmnl0 python-apt python-m2crypto python-psutil
-
-# Cleanup old kernels, ensure latest is installed via virtual package
-apt-get purge -y linux-image-* linux-headers-*
-if [ ! -f /tmp/no_install_kernel ]; then
- apt-get install -y linux-generic-lts-xenial
-
- # Update grub cmdline
- sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub
- sed -i 's|GRUB_CMDLINE_LINUX=.*|GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"|g' /etc/default/grub
- update-grub
-fi
-
-apt-get -y upgrade
-apt-get -y dist-upgrade
-
-apt-get autoremove --purge
-
-# Tmux fixes
-cat << 'EOF' >> /etc/tmux.conf
-set -g default-terminal "screen-256color"
-set -g set-titles on
-set -g xterm-keys on
-EOF
-
-# Install common prerequisites
-apt-get -y install apt-transport-https libmnl0 python-apt python-m2crypto python-psutil
-
-# Setup cloud-init
-apt-get -y install cloud-init
-
-# Motd
-apt-get -y install update-motd
-rm -vf /etc/update-motd.d/*
-echo "BUILD_TIMESTAMP=$(date '+%Y-%m-%d-%H-%M-%S' -u)" > /etc/image_version
-echo "BUILD_TIMESTAMP_RFC=\"$(date -u -R)\"" >> /etc/image_version
-cat << 'EOF' >> /etc/update-motd.d/00-header-mirantis
-#!/bin/sh
-#
-# 00-header - create the header of the MOTD
-#
-[ -r /etc/image_version ] && . /etc/image_version
-echo "Ubuntu 14.04 \"Trusty\" Mirantis cloud image"
-echo "Build date: ${BUILD_TIMESTAMP_RFC}"
-EOF
-chmod +x /etc/update-motd.d/00-header-mirantis
diff --git a/ubuntu-14.04/scripts/base.sh b/ubuntu-14.04/scripts/base.sh
new file mode 120000
index 0000000..7df0165
--- /dev/null
+++ b/ubuntu-14.04/scripts/base.sh
@@ -0,0 +1 @@
+../../common/ubuntu_trusty_base.sh
\ No newline at end of file
diff --git a/ubuntu-14.04/scripts/cleanup.sh b/ubuntu-14.04/scripts/cleanup.sh
deleted file mode 100644
index 7f2ba4d..0000000
--- a/ubuntu-14.04/scripts/cleanup.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-apt-get -y autoremove --purge
-apt-get -y clean
-rm -f /var/lib/apt/lists/*
-
-rm -f /usr/sbin/policy-rc.d || true
-
-echo "cleaning up hostname"
-sed -i "/.*ubuntu-1404.*/d" /etc/hosts
-
-echo "cleaning up guest additions"
-rm -rf VBoxGuestAdditions_*.iso VBoxGuestAdditions_*.iso.? || true
-
-echo "cleaning up dhcp leases"
-rm -f /var/lib/dhcp/* || true
-
-echo "cleaning up udev rules"
-rm -f /etc/udev/rules.d/70-persistent-net.rules || true
-rm -rf /dev/.udev/ || true
-rm -f /lib/udev/rules.d/75-persistent-net-generator.rules || true
-
-echo "cleaning up minion_id for salt"
-rm -f /etc/salt/minion_id || true
-
diff --git a/ubuntu-14.04/scripts/cleanup.sh b/ubuntu-14.04/scripts/cleanup.sh
new file mode 120000
index 0000000..cf970b6
--- /dev/null
+++ b/ubuntu-14.04/scripts/cleanup.sh
@@ -0,0 +1 @@
+../../common/ubuntu_cleanup.sh
\ No newline at end of file
diff --git a/ubuntu-14.04/scripts/docker.sh b/ubuntu-14.04/scripts/docker.sh
index 9ae4add..bd79ed8 100644
--- a/ubuntu-14.04/scripts/docker.sh
+++ b/ubuntu-14.04/scripts/docker.sh
@@ -1,5 +1,6 @@
# This should simulate preseed behavior
+apt-get update
apt-get -y install curl
# Add apt repository
@@ -7,6 +8,7 @@
echo "deb [arch=amd64] http://apt.mirantis.com/trusty/ nightly extra" > /etc/apt/sources.list.d/mcp_extra.list
curl -sf http://apt.mirantis.com/public.gpg | apt-key add -
+apt-get clean
apt-get update
# Kernel makes no sense in docker, let base.sh know
diff --git a/ubuntu-14.04/scripts/info.sh b/ubuntu-14.04/scripts/info.sh
new file mode 120000
index 0000000..772d054
--- /dev/null
+++ b/ubuntu-14.04/scripts/info.sh
@@ -0,0 +1 @@
+../../common/ubuntu_info.sh
\ No newline at end of file
diff --git a/ubuntu-14.04/scripts/motd.sh b/ubuntu-14.04/scripts/motd.sh
new file mode 100644
index 0000000..e215a29
--- /dev/null
+++ b/ubuntu-14.04/scripts/motd.sh
@@ -0,0 +1,17 @@
+#!/bin/bash -xe
+# Motd
+apt-get -y install update-motd
+rm -vf /etc/update-motd.d/*
+echo "BUILD_TIMESTAMP=$(date '+%Y-%m-%d-%H-%M-%S' -u)" > /etc/image_version
+echo "BUILD_TIMESTAMP_RFC=\"$(date -u -R)\"" >> /etc/image_version
+cat << 'EOF' >> /etc/update-motd.d/00-header-mirantis
+#!/bin/sh
+#
+# 00-header - create the header of the MOTD
+#
+[ -r /etc/image_version ] && . /etc/image_version
+echo "Ubuntu 16.04 \"Trusty\" Mirantis cloud image"
+echo "Build date: ${BUILD_TIMESTAMP_RFC}"
+EOF
+chmod +x /etc/update-motd.d/00-header-mirantis
+
diff --git a/ubuntu-14.04/scripts/network.sh b/ubuntu-14.04/scripts/network.sh
new file mode 120000
index 0000000..ab1de37
--- /dev/null
+++ b/ubuntu-14.04/scripts/network.sh
@@ -0,0 +1 @@
+../../common/ubuntu_network.sh
\ No newline at end of file
diff --git a/ubuntu-14.04/scripts/salt.sh b/ubuntu-14.04/scripts/salt.sh
index b5d5813..8286c9b 100644
--- a/ubuntu-14.04/scripts/salt.sh
+++ b/ubuntu-14.04/scripts/salt.sh
@@ -1,9 +1,16 @@
-wget -O - https://repo.saltstack.com/apt/ubuntu/14.04/amd64/2016.3/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
-echo "deb http://repo.saltstack.com/apt/ubuntu/14.04/amd64/2016.3 trusty main" >/etc/apt/sources.list.d/saltstack.list
+#!/bin/bash -xe
+
+SALTSTACK_REPO=${SALTSTACK_REPO:-"deb [arch=amd64] https://mirror.mirantis.com/stable/saltstack-2017.7/trusty/ trusty main"}
+SALTSTACK_GPG=${SALTSTACK_GPG:-"https://mirror.mirantis.com/proposed/saltstack-2017.7/trusty/SALTSTACK-GPG-KEY.pub"}
+
+wget -O - ${SALTSTACK_GPG} | sudo apt-key add -
+echo "${SALTSTACK_REPO}" > /etc/apt/sources.list.d/saltstack.list
+
apt-get update
apt-get -y install salt-minion
mkdir -m700 -p /etc/salt/pki/minion
-echo "
+
+cat <<EOF >> /etc/salt/minion.d/minion.conf
max_event_size: 100000000
acceptance_wait_time_max: 60
acceptance_wait_time: 10
@@ -11,4 +18,7 @@
recon_default: 1000
recon_max: 60000
recon_randomize: True
-auth_timeout: 60" >> /etc/salt/minion
+auth_timeout: 60
+EOF
+
+rm -vf /etc/apt/sources.list.d/saltstack.list
diff --git a/ubuntu-14.04/scripts/security.sh b/ubuntu-14.04/scripts/security.sh
new file mode 120000
index 0000000..31e630f
--- /dev/null
+++ b/ubuntu-14.04/scripts/security.sh
@@ -0,0 +1 @@
+../../common/ubuntu_trusty_security.sh
\ No newline at end of file
diff --git a/ubuntu-14.04/template.json b/ubuntu-14.04/template.json
index b91fa95..8e7091e 100644
--- a/ubuntu-14.04/template.json
+++ b/ubuntu-14.04/template.json
@@ -1,21 +1,41 @@
{
"variables": {
"user": "root",
- "password": "ho5uo7Uome5d",
- "do_api_token": "{{ env `DO_API_TOKEN` }}",
+ "password": "r00tme",
"distro": "ubuntu-14-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` }}",
+ "do_api_token": "{{ env `DO_API_TOKEN` }}",
"image_name": "{{ env `IMAGE_NAME` }}",
- "disk_size": "8000"
+ "os_username": "{{ env `OS_USERNAME` }}",
+ "os_password": "{{ env `OS_PASSWORD` }}",
+ "os_image": "7451fac0-0ce5-4d30-ae36-cd9a90e7948e",
+ "os_endpoint": "https://cloud-cz.bud.mirantis.net:5000/v2.0",
+ "os_zone": "mcp-mk",
+ "os_floating_ip_pool": "public",
+ "os_tenant": "26e4dd19485249608ee3685f254f3909",
+ "os_network": "772f8ca6-1f4a-4535-99d0-880d6ead9a82"
},
"provisioners": [
{
"type": "shell",
- "execute_command": "sh '{{.Path}}'",
+ "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
+ "expect_disconnect": "true",
+ "environment_vars": [
+ "UBUNTU_BASEURL={{ user `ubuntu_baseurl` }}",
+ "SALTSTACK_GPG={{ user `saltstack_gpg` }}",
+ "SALTSTACK_REPO={{ user `saltstack_repo` }}"
+ ],
"override": {
"virtualbox-iso": {
"scripts": [
"scripts/base.sh",
+ "scripts/motd.sh",
"scripts/salt.sh",
+ "scripts/network.sh",
"scripts/vagrant.sh",
"scripts/virtualbox.sh",
"scripts/security.sh",
@@ -26,6 +46,7 @@
"vmware-iso": {
"scripts": [
"scripts/base.sh",
+ "scripts/motd.sh",
"scripts/salt.sh",
"scripts/vmware.sh",
"scripts/security.sh",
@@ -36,9 +57,24 @@
"qemu": {
"scripts": [
"scripts/base.sh",
+ "scripts/motd.sh",
"scripts/salt.sh",
+ "scripts/network.sh",
+ "scripts/cleanup.sh",
+ "scripts/info.sh",
+ "scripts/security.sh",
+ "scripts/zerodisk.sh"
+ ]
+ },
+ "openstack": {
+ "scripts": [
+ "scripts/base.sh",
+ "scripts/motd.sh",
+ "scripts/salt.sh",
+ "scripts/network.sh",
"scripts/security.sh",
"scripts/cleanup.sh",
+ "scripts/info.sh",
"scripts/zerodisk.sh"
]
},
@@ -46,6 +82,7 @@
"scripts": [
"scripts/docker.sh",
"scripts/base.sh",
+ "scripts/motd.sh",
"scripts/salt.sh",
"scripts/cleanup.sh"
]
@@ -53,6 +90,7 @@
"digitalocean": {
"scripts": [
"scripts/base.sh",
+ "scripts/motd.sh",
"scripts/salt.sh",
"scripts/security.sh",
"scripts/cleanup.sh"
@@ -62,12 +100,12 @@
},
{
"type": "file",
- "source": "configs/cloud/cloud.cfg.d/99_tcp.cfg",
+ "source": "files/etc/cloud/cloud.cfg.d/99_tcp.cfg",
"destination": "/etc/cloud/cloud.cfg.d/99_tcp.cfg"
},
{
"type": "file",
- "source": "configs/cloud/cloud.cfg",
+ "source": "files/etc/cloud/cloud.cfg",
"destination": "/etc/cloud/cloud.cfg"
}
],
@@ -131,9 +169,9 @@
"output_directory": "images/{{ user `distro` }}-vbox-{{ isotime \"200601021504\" }}",
"guest_os_type": "Ubuntu_64",
"http_directory": "http",
- "iso_checksum": "dd54dc8cfc2a655053d19813c2f9aa9f",
+ "iso_checksum": "10fcd20619dce11fe094e960c85ba4a9",
"iso_checksum_type": "md5",
- "iso_url": "http://releases.ubuntu.mirror.dkm.cz/releases/14.04/ubuntu-14.04.5-server-amd64.iso",
+ "iso_url": "http://releases.ubuntu.com/14.04/ubuntu-14.04.3-server-amd64.iso",
"ssh_username": "{{user `user`}}",
"ssh_password": "{{user `password`}}",
"ssh_port": 22,
@@ -208,9 +246,9 @@
"output_directory": "images/{{ user `distro` }}-vmware-{{ isotime \"200601021504\" }}",
"guest_os_type": "linux",
"http_directory": "http",
- "iso_checksum": "dd54dc8cfc2a655053d19813c2f9aa9f",
+ "iso_checksum": "10fcd20619dce11fe094e960c85ba4a9",
"iso_checksum_type": "md5",
- "iso_url": "http://releases.ubuntu.mirror.dkm.cz/releases/14.04/ubuntu-14.04.5-server-amd64.iso",
+ "iso_url": "http://releases.ubuntu.com/14.04/ubuntu-14.04.3-server-amd64.iso",
"ssh_username": "{{user `user`}}",
"ssh_password": "{{user `password`}}",
"ssh_port": 22,
@@ -223,56 +261,6 @@
}
},
{
- "type": "qemu",
- "qemuargs": [
- [
- "-m",
- "1024M"
- ]
- ],
- "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}",
- "output_directory": "images/{{ user `distro` }}-qemu-{{ isotime \"200601021504\" }}",
- "format": "qcow2",
- "accelerator": "kvm",
- "disk_size": "{{ user `disk_size`}}",
- "iso_url": "http://releases.ubuntu.mirror.dkm.cz/releases/14.04/ubuntu-14.04.5-server-amd64.iso",
- "iso_checksum_type": "md5",
- "iso_checksum": "dd54dc8cfc2a655053d19813c2f9aa9f",
- "http_directory": "http",
- "headless": true,
- "ssh_username": "{{user `user`}}",
- "ssh_password": "{{user `password`}}",
- "shutdown_command": "shutdown -P now",
- "boot_wait": "2s",
- "ssh_wait_timeout": "10000s",
- "boot_command": [
- "<esc><wait>",
- "<esc><wait>",
- "<enter><wait>",
- "/install/vmlinuz<wait>",
- " auto<wait>",
- " console-setup/ask_detect=false<wait>",
- " console-setup/layoutcode=us<wait>",
- " console-setup/modelcode=pc105<wait>",
- " debconf/frontend=noninteractive<wait>",
- " debian-installer=en_US<wait>",
- " fb=false<wait>",
- " initrd=/install/initrd.gz<wait>",
- " kbd-chooser/method=us<wait>",
- " keyboard-configuration/layout=USA<wait>",
- " keyboard-configuration/variant=USA<wait>",
- " passwd/root-password={{user `password`}} ",
- " passwd/root-password-again={{user `password`}} ",
- " locale=en_US<wait>",
- " netcfg/get_hostname=ubuntu-1404<wait>",
- " netcfg/get_domain=changeme<wait>",
- " noapic<wait>",
- " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
- " -- <wait>",
- "<enter><wait>"
- ]
- },
- {
"type": "docker",
"image": "ubuntu:14.04",
"commit": true
@@ -284,6 +272,49 @@
"snapshot_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}",
"region": "ams2",
"size": "1gb"
+ },
+ {
+ "type": "qemu",
+ "qemuargs": [
+ [ "-m", "1024M" ],
+ [ "-cdrom", "config-drive/cloudata.iso" ]
+ ],
+ "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}",
+ "output_directory": "images/{{ user `image_name` }}-qemu-{{ isotime \"200601021504\" }}",
+ "format": "qcow2",
+ "iso_checksum": "06d561ab1ae8723493b484c1effc2790",
+ "iso_checksum_type": "md5",
+ "iso_url": "http://cloud-images.ubuntu.com/releases/trusty/release-20180703/ubuntu-14.04-server-cloudimg-amd64-disk1.img",
+ "iso_target_path": "{{ user `images_cache`}}/release-20180703_ubuntu-14.04-server-cloudimg-amd64-disk1.img",
+ "disk_image": true,
+ "disk_compression": true,
+ "accelerator": "kvm",
+ "disk_size": "{{ user `disk_size`}}",
+ "headless": true,
+ "ssh_username": "{{ user `user` }}",
+ "ssh_password": "{{ user `password` }}",
+ "ssh_host_port_min": 7000,
+ "ssh_host_port_max": 7050,
+ "shutdown_command": "shutdown -P now",
+ "boot_wait": "2s",
+ "ssh_wait_timeout": "360s"
+ },
+ {
+ "type": "openstack",
+ "ssh_username": "{{ user `user` }}",
+ "ssh_password": "{{ user `password` }}",
+ "image_name": "{{user `image_name`}}",
+ "floating_ip_pool": "{{user `os_floating_ip_pool`}}",
+ "reuse_ips": "true",
+ "source_image": "{{ user `os_image` }}",
+ "flavor": "{{ user `os_flavor` }}",
+ "user_data_file": "config-drive/user-data.yaml",
+ "tenant_id": "{{ user `os_tenant` }}",
+ "networks": ["{{ user `os_network` }}"],
+ "availability_zone": "{{user `os_zone`}}",
+ "identity_endpoint": "{{user `os_endpoint`}}",
+ "username": "{{user `os_username`}}",
+ "password": "{{user `os_password`}}"
}
]
-}
\ No newline at end of file
+}
diff --git a/ubuntu-14.04/template.json.env b/ubuntu-14.04/template.json.env
new file mode 100644
index 0000000..6eb61c4
--- /dev/null
+++ b/ubuntu-14.04/template.json.env
@@ -0,0 +1,17 @@
+# Env variables and description:
+#DO_API_TOKEN
+PACKER_IMAGES_CACHE="${HOME}/packer_images_cache/"
+
+
+# base.sh
+UBUNTU_BASEURL=http://mirror.mirantis.com/stable/ubuntu/
+
+# salt.sh
+SALTSTACK_REPO=${SALTSTACK_REPO:-"deb [arch=amd64] https://mirror.mirantis.com/stable/saltstack-2016.3/trusty/ trusty main"}
+SALTSTACK_GPG=${SALTSTACK_GPG:-"https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3/SALTSTACK-GPG-KEY.pub"}
+
+
+
+# resulted openstack|qemu image name part
+IMAGE_NAME="ubuntu-14-04-x64"
+
diff --git a/ubuntu-16.04/run.example.sh b/ubuntu-16.04/run.example.sh
index df58f50..fefb086 100644
--- a/ubuntu-16.04/run.example.sh
+++ b/ubuntu-16.04/run.example.sh
@@ -14,7 +14,7 @@
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"
+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/"
diff --git a/ubuntu-16.04/scripts/salt.sh b/ubuntu-16.04/scripts/salt.sh
index 2ddedc4..eba5bca 100644
--- a/ubuntu-16.04/scripts/salt.sh
+++ b/ubuntu-16.04/scripts/salt.sh
@@ -1,7 +1,7 @@
#!/bin/bash -xe
-SALTSTACK_REPO=${SALTSTACK_REPO:-"deb [arch=amd64] https://mirror.mirantis.com/stable/saltstack-2016.3/xenial/ xenial main"}
-SALTSTACK_GPG=${SALTSTACK_GPG:-"https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3/SALTSTACK-GPG-KEY.pub"}
+SALTSTACK_REPO=${SALTSTACK_REPO:-"deb [arch=amd64] https://mirror.mirantis.com/stable/saltstack-2017.7/xenial/ xenial main"}
+SALTSTACK_GPG=${SALTSTACK_GPG:-"https://mirror.mirantis.com/proposed/saltstack-2017.7/xenial/SALTSTACK-GPG-KEY.pub"}
wget -O - ${SALTSTACK_GPG} | sudo apt-key add -
echo "${SALTSTACK_REPO}" > /etc/apt/sources.list.d/saltstack.list
diff --git a/ubuntu-16.04/template.json b/ubuntu-16.04/template.json
index 284237e..77af90c 100644
--- a/ubuntu-16.04/template.json
+++ b/ubuntu-16.04/template.json
@@ -154,8 +154,8 @@
" kbd-chooser/method=us<wait>",
" keyboard-configuration/layout=USA<wait>",
" keyboard-configuration/variant=USA<wait>",
- " passwd/root-password={{user `password`}} ",
- " passwd/root-password-again={{user `password`}} ",
+ " passwd/root-password={{ user `password` }} ",
+ " passwd/root-password-again={{ user `password` }} ",
" locale=en_US<wait>",
" netcfg/get_hostname=ubuntu-1604<wait>",
" netcfg/get_domain=cloudlab.cz<wait>",
@@ -172,8 +172,8 @@
"iso_checksum": "10fcd20619dce11fe094e960c85ba4a9",
"iso_checksum_type": "md5",
"iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.3-server-amd64.iso",
- "ssh_username": "{{user `user`}}",
- "ssh_password": "{{user `password`}}",
+ "ssh_username": "{{ user `user` }}",
+ "ssh_password": "{{ user `password` }}",
"ssh_port": 22,
"ssh_wait_timeout": "10000s",
"shutdown_command": "shutdown -P now",
@@ -277,7 +277,7 @@
"type": "qemu",
"qemuargs": [
[ "-m", "1024M" ],
- [ "-fda", "config-drive/cloudata.iso" ]
+ [ "-cdrom", "config-drive/cloudata.iso" ]
],
"vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}",
"output_directory": "images/{{ user `image_name` }}-qemu-{{ isotime \"200601021504\" }}",
@@ -291,8 +291,8 @@
"accelerator": "kvm",
"disk_size": "{{ user `disk_size`}}",
"headless": true,
- "ssh_username": "{{user `user`}}",
- "ssh_password": "{{user `password`}}",
+ "ssh_username": "{{ user `user` }}",
+ "ssh_password": "{{ user `password` }}",
"ssh_host_port_min": 7000,
"ssh_host_port_max": 7050,
"shutdown_command": "shutdown -P now",