blob: 16bafc82dcc1a5b8f8d7c4fe8dd39c0738672237 [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
# linux.system.file only for backwards compatibility of jenkins - mcp-common-scripts
salt-call -t 5 --retcode-passthrough --no-color state.sls jenkins.master,linux.system.file
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