blob: c7bc7f14af035d81a60870edcf56a044c49d0bb9 [file] [log] [blame]
#!/bin/bash -xe
FORMULA_VERSION=${FORMULA_VERSION:-2018.3.1}
APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $FORMULA_VERSION salt"}
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.user,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 openssh
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