blob: fed903db7cbad96212454ac4c9ee5e3db68964db [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 Broulike643a832018-04-11 13:32:15 +02003FORMULA_VERSION=${FORMULA_VERSION:-testing}
4SALTSTACK_GPG=${SALTSTACK_GPG:-"https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3/SALTSTACK-GPG-KEY.pub"}
5SALTSTACK_REPO=${SALTSTACK_REPO:-"http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3 xenial main"}
6APT_MIRANTIS_GPG=${APT_MIRANTIS_GPG:-"http://apt.mirantis.com/public.gpg"}
7APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $FORMULA_VERSION salt"}
8GIT_SALT_FORMULAS_SCRIPTS=${GIT_SALT_FORMULAS_SCRIPTS:-"https://github.com/salt-formulas/salt-formulas-scripts"}
Jiri Broulik4ea221c2018-04-10 13:48:06 +02009GIT_SALT_FORMULAS_SCRIPTS_REF=${GIT_SALT_FORMULAS_SCRIPTS_REF:-master}
10
11wget -O - ${SALTSTACK_GPG} | sudo apt-key add -
12wget -O - ${APT_MIRANTIS_GPG} | apt-key add -
13echo "deb [arch=amd64] ${SALTSTACK_REPO}" > /etc/apt/sources.list.d/saltstack.list
14apt-get update
15apt-get install git-core -y
16
17for g_host in ${CLUSTER_MODEL} ${GIT_SALT_FORMULAS_SCRIPTS} ; do
18 _tmp_host=$(echo ${g_host} | awk -F/ '{print $3}')
19 ssh-keyscan -T 1 -H ${_tmp_host} >> ~/.ssh/known_hosts || true
20done
21
22if [[ ! -d /srv/salt/reclass ]]; then
23 git clone --recursive ${CLUSTER_MODEL} /srv/salt/reclass
24 pushd /srv/salt/reclass/
25 git checkout ${CLUSTER_MODEL_REF}
26 popd
27fi
28
29if [[ ! -d /srv/salt/scripts ]]; then
30 git clone --recursive ${GIT_SALT_FORMULAS_SCRIPTS} /srv/salt/scripts
31 pushd /srv/salt/scripts/
32 git checkout ${GIT_SALT_FORMULAS_SCRIPTS_REF}
33 popd
34fi
35
36# bootstrap.sh opts
37export FORMULAS_SOURCE=pkg
38export HOSTNAME=cfg01
39export DOMAIN="${CLUSTER_NAME}.local"
40export EXTRA_FORMULAS="git ntp maas jenkins"
41export APT_REPOSITORY=" deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO} "
42export APT_REPOSITORY_GPG=${APT_MIRANTIS_GPG}
43
44if [[ ! -f /srv/salt/scripts/bootstrap.sh ]]; then
45 echo "ERROR: File /srv/salt/scripts/bootstrap.sh not found"
46 exit 1
47fi
48bash -x /srv/salt/scripts/bootstrap.sh || true