blob: f23a447446494f332b0d434821dfc93d6a8166df [file] [log] [blame]
Jiri Broulik4ea221c2018-04-10 13:48:06 +02001#!/bin/bash -xe
Jiri Broulik4ea221c2018-04-10 13:48:06 +02002CLUSTER_MODEL_REF=${CLUSTER_MODEL_REF:-master}
Jiri Broulik4ea221c2018-04-10 13:48:06 +02003GIT_SALT_FORMULAS_SCRIPTS_REF=${GIT_SALT_FORMULAS_SCRIPTS_REF:-master}
4
5wget -O - ${SALTSTACK_GPG} | sudo apt-key add -
6wget -O - ${APT_MIRANTIS_GPG} | apt-key add -
7echo "deb [arch=amd64] ${SALTSTACK_REPO}" > /etc/apt/sources.list.d/saltstack.list
8apt-get update
9apt-get install git-core -y
10
11for g_host in ${CLUSTER_MODEL} ${GIT_SALT_FORMULAS_SCRIPTS} ; do
12 _tmp_host=$(echo ${g_host} | awk -F/ '{print $3}')
13 ssh-keyscan -T 1 -H ${_tmp_host} >> ~/.ssh/known_hosts || true
14done
15
16if [[ ! -d /srv/salt/reclass ]]; then
17 git clone --recursive ${CLUSTER_MODEL} /srv/salt/reclass
18 pushd /srv/salt/reclass/
19 git checkout ${CLUSTER_MODEL_REF}
20 popd
21fi
22
23if [[ ! -d /srv/salt/scripts ]]; then
24 git clone --recursive ${GIT_SALT_FORMULAS_SCRIPTS} /srv/salt/scripts
25 pushd /srv/salt/scripts/
26 git checkout ${GIT_SALT_FORMULAS_SCRIPTS_REF}
27 popd
28fi
29
30# bootstrap.sh opts
31export FORMULAS_SOURCE=pkg
32export HOSTNAME=cfg01
33export DOMAIN="${CLUSTER_NAME}.local"
34export EXTRA_FORMULAS="git ntp maas jenkins"
35export APT_REPOSITORY=" deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO} "
36export APT_REPOSITORY_GPG=${APT_MIRANTIS_GPG}
37
38if [[ ! -f /srv/salt/scripts/bootstrap.sh ]]; then
39 echo "ERROR: File /srv/salt/scripts/bootstrap.sh not found"
40 exit 1
41fi
42bash -x /srv/salt/scripts/bootstrap.sh || true