blob: ffa106ba3a55d4f9a937e586732296c51d8d5092 [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
Jiri Broulik4ea221c2018-04-10 13:48:06 +02007echo "deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO}" > /etc/apt/sources.list.d/mcp_salt.list
8apt-get update
9apt-get install salt-formula* -y
azvyagintsev0adfe682018-06-13 16:29:40 +030010
Ivan Berezovskiy738ce822018-11-16 13:00:24 +040011# Wait for salt-master and salt-minion to wake up after restart
12# since we just perform 'reboot.sh'
13salt-call --timeout=120 test.ping
14
15salt-call ${SALT_OPTS} saltutil.clear_cache
16salt-call ${SALT_OPTS} saltutil.refresh_pillar
17salt-call ${SALT_OPTS} saltutil.sync_all
18salt-call ${SALT_OPTS} reclass.validate_pillar
19
20salt-call ${SALT_OPTS} state.sls linux.system.repo,linux.system.package,linux.system.user,linux.system.directory,linux.system.file,linux.system.config
azvyagintsev0adfe682018-06-13 16:29:40 +030021salt-call ${SALT_OPTS} state.sls linux.network
Ivan Berezovskiy738ce822018-11-16 13:00:24 +040022salt-call ${SALT_OPTS} state.sls salt.minion.ca
23
24salt-call ${SALT_OPTS} state.sls salt
25salt-call ${SALT_OPTS} state.sls docker.host
26
azvyagintsev0adfe682018-06-13 16:29:40 +030027salt-call ${SALT_OPTS} state.sls openssh
28salt-call ${SALT_OPTS} state.sls git.server
29salt-call ${SALT_OPTS} state.sls postgresql
30# install only MAAS packages, don't configure anything.
31# Configuration will be processed during cfg01 initialization.
32# Those step, required to have clean MAAS configuration - w\o auto import and etc.
33salt-call ${SALT_OPTS} state.sls_id maas_cluster_packages maas
34salt-call ${SALT_OPTS} state.sls_id maas_region_packages maas
35
azvyagintsev0adfe682018-06-13 16:29:40 +030036# FIXME move those into cluster model
Jiri Broulik4ea221c2018-04-10 13:48:06 +020037git clone https://github.com/Mirantis/docker-jenkins.git
Ivan Berezovskiy738ce822018-11-16 13:00:24 +040038mkdir -p /srv/volumes/jenkins/userContent/theme/
39cp -r docker-jenkins/theme/* /srv/volumes/jenkins/userContent/theme/
40rm -rf docker-jenkins
41chown -R 1000:1000 /srv/volumes/jenkins/userContent/
42
43docker pull "docker-prod-local.artifactory.mirantis.com/mirantis/cicd/jenkins:${MCP_VERSION}"
44docker pull "docker-prod-local.artifactory.mirantis.com/mirantis/cicd/jnlp-slave:${MCP_VERSION}"
45# Flag for cloud-init script
46touch /root/jenkins_in_docker
Jiri Broulik4ea221c2018-04-10 13:48:06 +020047
azvyagintsev05e84372018-10-17 17:31:28 +030048# Duplicate of ubuntu_info.sh
49mkdir -p /var/log/bootstrap_logs/ ; pushd /var/log/bootstrap_logs/
50 # Drop some reclass info,if available
51 if [[ $(which salt-key) ]] ; then
52 for node in $(salt-key -l acc | grep -v 'Accepted Keys:') ; do
53 salt ${node} pillar.data --out=json > ${node}.pillardata.json || true
54 reclass -n ${node} -o json > ${node}.reclass.json || true
55 done
56 fi
57popd