blob: 6074f21e8c78e239e834edee64e1de8f6ac4e5c7 [file] [log] [blame]
Jiri Broulik4ea221c2018-04-10 13:48:06 +02001#!/bin/bash -xe
2
Ivan Berezovskiybd80ff42018-11-30 14:38:02 +04003MCP_VERSION=${MCP_VERSION:-proposed}
4APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $MCP_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
Ivan Berezovskiy738ce822018-11-16 13:00:24 +040036# Flag for cloud-init script
Ivan Berezovskiybd80ff42018-11-30 14:38:02 +040037touch /opt/jenkins_in_docker
Jiri Broulik4ea221c2018-04-10 13:48:06 +020038
azvyagintsev05e84372018-10-17 17:31:28 +030039# Duplicate of ubuntu_info.sh
40mkdir -p /var/log/bootstrap_logs/ ; pushd /var/log/bootstrap_logs/
41 # Drop some reclass info,if available
42 if [[ $(which salt-key) ]] ; then
43 for node in $(salt-key -l acc | grep -v 'Accepted Keys:') ; do
44 salt ${node} pillar.data --out=json > ${node}.pillardata.json || true
45 reclass -n ${node} -o json > ${node}.reclass.json || true
46 done
47 fi
48popd