day1
PROD-18791
Change-Id: I2f47ea12d166676e583323b60d2798f184c8ef9a
diff --git a/day01-image/scripts/salt.sh b/day01-image/scripts/salt.sh
new file mode 100644
index 0000000..6e2dcd0
--- /dev/null
+++ b/day01-image/scripts/salt.sh
@@ -0,0 +1,43 @@
+#!/bin/bash -xe
+
+FORMULA_VERSION=${FORMULA_VERSION:-testing}
+APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $FORMULA_VERSION salt"}
+MASTER=`salt-key | grep cfg01`
+
+salt-key
+
+salt-call -t 5 --retcode-passthrough reclass.validate_pillar
+
+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
+salt-call -t 5 --retcode-passthrough --no-color state.sls salt
+salt-call -t 5 --retcode-passthrough --no-color state.sls linux.system.repo,linux.system.package,linux.system.directory,linux.system.config
+salt-call -t 5 --retcode-passthrough --no-color state.sls linux.network
+salt-call -t 5 --retcode-passthrough --no-color state.sls git.server
+salt-call -t 5 --retcode-passthrough --no-color state.sls postgresql
+salt-call -t 5 --no-color state.sls maas
+# will not be needed with new maas formula
+apt-get install simplestreams -y
+sstream-mirror --keyring=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg http://images.maas.io/ephemeral-v3/daily/ /var/www/html/maas/images/ephemeral-v3/daily 'arch=amd64' 'release~(xenial)' --max=1
+
+salt-call -t 5 --retcode-passthrough --no-color state.sls jenkins.master
+sleep 60
+salt-call -t 5 --no-color state.sls jenkins.client.plugin
+systemctl restart jenkins
+sleep 60
+# Jenkins Mirantis theme
+git clone https://github.com/Mirantis/docker-jenkins.git
+cp -r docker-jenkins/theme /var/lib/jenkins/userContent
+chown -R jenkins:jenkins /var/lib/jenkins/userContent/*
+# finish Jenkins setup
+salt-call -t 5 --no-color state.sls jenkins.client.plugin
+systemctl restart jenkins
+sleep 60
+salt-call -t 5 --no-color state.sls jenkins.client
+systemctl restart jenkins
+sleep 60
+salt-call -t 5 --retcode-passthrough --no-color state.sls jenkins.client
+