blob: 453c3fb2d200773a09a10fd45ad42c560063cfbe [file] [log] [blame]
azvyagintsev6d453852018-02-26 16:56:37 +02001#!/bin/bash -xe
2
azvyagintsevc86fbaf2018-03-02 18:57:03 +02003CLUSTER_MODEL_REF=${CLUSTER_MODEL_REF:-master}
4FORMULA_VERSION=${FORMULA_VERSION:-testing}
azvyagintsev6d453852018-02-26 16:56:37 +02005SALTSTACK_GPG=${SALTSTACK_GPG:-"https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3/SALTSTACK-GPG-KEY.pub"}
6SALTSTACK_REPO=${SALTSTACK_REPO:-"http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3 xenial main"}
7APT_MIRANTIS_GPG=${APT_MIRANTIS_GPG:-"http://apt.mirantis.com/public.gpg"}
Richard Felkl47757902018-03-02 22:44:43 +01008APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $FORMULA_VERSION salt"}
azvyagintsev6d453852018-02-26 16:56:37 +02009GIT_SALT_FORMULAS_SCRIPTS=${GIT_SALT_FORMULAS_SCRIPTS:-"https://github.com/salt-formulas/salt-formulas-scripts"}
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
16for g_host in ${CLUSTER_MODEL} ${GIT_SALT_FORMULAS_SCRIPTS} ; do
17 _tmp_host=$(echo ${g_host} | awk -F/ '{print $3}')
18 ssh-keyscan -T 1 -H ${_tmp_host} >> ~/.ssh/known_hosts || true
19done
20
21git clone --recursive -b ${CLUSTER_MODEL_REF} ${CLUSTER_MODEL} /srv/salt/reclass || true
22git clone ${GIT_SALT_FORMULAS_SCRIPTS} /srv/salt/scripts || true
23# bootstrap.sh opts
24export FORMULAS_SOURCE=pkg
25export HOSTNAME=apt01
26export DOMAIN="${CLUSTER_NAME}.local"
27export EXTRA_FORMULAS="ntp aptly nginx iptables docker"
28export APT_REPOSITORY=" deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO} "
29export APT_REPOSITORY_GPG=${APT_MIRANTIS_GPG}
30if [[ ! -z "${PACKER_OFFLINE_BUILD}" ]];then
azvyagintsevc86fbaf2018-03-02 18:57:03 +020031 echo "INFO: build in offline detected!"
32 export BOOTSTRAP_SALTSTACK_COM="file:///tmp/bootstrap.saltstack.com.sh"
33 # extra opts will push bootstrap script NOT install upstream repos.
azvyagintsev6d453852018-02-26 16:56:37 +020034 export BOOTSTRAP_SALTSTACK_OPTS=${BOOTSTRAP_SALTSTACK_OPTS:- -dXr $BOOTSTRAP_SALTSTACK_VERSION }
35fi
36#
37bash -x /srv/salt/scripts/bootstrap.sh || true