blob: 7e583728d8a9a98c482479464baa63091873e44d [file] [log] [blame]
Jiri Broulik4ea221c2018-04-10 13:48:06 +02001#!/bin/bash -xe
2
Jiri Broulikddd55262018-04-11 14:52:43 +02003FORMULA_VERSION=${FORMULA_VERSION:-2018.3.1}
Jiri Broulik05c5b602018-04-11 13:52:37 +02004APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $FORMULA_VERSION salt"}
azvyagintsev0adfe682018-06-13 16:29:40 +03005SALT_OPTS="-t 10 --retcode-passthrough --no-color"
Jiri Broulik05c5b602018-04-11 13:52:37 +02006
azvyagintsev0adfe682018-06-13 16:29:40 +03007salt-call ${SALT_OPTS} reclass.validate_pillar
Jiri Broulikaa400a02018-04-12 00:18:47 +02008
Jiri Broulik4ea221c2018-04-10 13:48:06 +02009echo "deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO}" > /etc/apt/sources.list.d/mcp_salt.list
10apt-get update
11apt-get install salt-formula* -y
azvyagintsev0adfe682018-06-13 16:29:40 +030012
Jiri Broulik4ea221c2018-04-10 13:48:06 +020013salt-call saltutil.refresh_pillar
14salt-call saltutil.sync_all
azvyagintsev0adfe682018-06-13 16:29:40 +030015salt-call ${SALT_OPTS} state.sls salt
16salt-call ${SALT_OPTS} state.sls linux.system.repo,linux.system.package,linux.system.user,linux.system.directory,linux.system.config
17salt-call ${SALT_OPTS} state.sls linux.network
18salt-call ${SALT_OPTS} state.sls openssh
19salt-call ${SALT_OPTS} state.sls git.server
20salt-call ${SALT_OPTS} state.sls postgresql
21# install only MAAS packages, don't configure anything.
22# Configuration will be processed during cfg01 initialization.
23# Those step, required to have clean MAAS configuration - w\o auto import and etc.
24salt-call ${SALT_OPTS} state.sls_id maas_cluster_packages maas
25salt-call ${SALT_OPTS} state.sls_id maas_region_packages maas
26
Jiri Broulik3ffb7452018-04-12 10:37:07 +020027# linux.system.file only for backwards compatibility of jenkins - mcp-common-scripts
azvyagintsev0adfe682018-06-13 16:29:40 +030028salt-call ${SALT_OPTS} state.sls jenkins.master,linux.system.file
Jiri Broulik4ea221c2018-04-10 13:48:06 +020029sleep 60
30salt-call -t 5 --no-color state.sls jenkins.client.plugin
31systemctl restart jenkins
32sleep 60
33# Jenkins Mirantis theme
azvyagintsev0adfe682018-06-13 16:29:40 +030034# FIXME move those into cluster model
Jiri Broulik4ea221c2018-04-10 13:48:06 +020035git clone https://github.com/Mirantis/docker-jenkins.git
36cp -r docker-jenkins/theme /var/lib/jenkins/userContent
37chown -R jenkins:jenkins /var/lib/jenkins/userContent/*
38# finish Jenkins setup
39salt-call -t 5 --no-color state.sls jenkins.client.plugin
40systemctl restart jenkins
41sleep 60
42salt-call -t 5 --no-color state.sls jenkins.client
43systemctl restart jenkins
44sleep 60
azvyagintsev0adfe682018-06-13 16:29:40 +030045salt-call ${SALT_OPTS} state.sls jenkins.client
Jiri Broulik4ea221c2018-04-10 13:48:06 +020046
azvyagintsev05e84372018-10-17 17:31:28 +030047# Duplicate of ubuntu_info.sh
48mkdir -p /var/log/bootstrap_logs/ ; pushd /var/log/bootstrap_logs/
49 # Drop some reclass info,if available
50 if [[ $(which salt-key) ]] ; then
51 for node in $(salt-key -l acc | grep -v 'Accepted Keys:') ; do
52 salt ${node} pillar.data --out=json > ${node}.pillardata.json || true
53 reclass -n ${node} -o json > ${node}.reclass.json || true
54 done
55 fi
56popd