azvyagintsev | 6d45385 | 2018-02-26 16:56:37 +0200 | [diff] [blame^] | 1 | #!/bin/bash -xe |
| 2 | |
| 3 | # CLUSTER_MODEL_REF= |
| 4 | SALTSTACK_GPG=${SALTSTACK_GPG:-"https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3/SALTSTACK-GPG-KEY.pub"} |
| 5 | SALTSTACK_REPO=${SALTSTACK_REPO:-"http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.3 xenial main"} |
| 6 | APT_MIRANTIS_GPG=${APT_MIRANTIS_GPG:-"http://apt.mirantis.com/public.gpg"} |
| 7 | APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ ${FORMULA_VERSION} salt"} |
| 8 | GIT_SALT_FORMULAS_SCRIPTS=${GIT_SALT_FORMULAS_SCRIPTS:-"https://github.com/salt-formulas/salt-formulas-scripts"} |
| 9 | |
| 10 | wget -O - ${SALTSTACK_GPG} | sudo apt-key add - |
| 11 | wget -O - ${APT_MIRANTIS_GPG} | apt-key add - |
| 12 | echo "deb [arch=amd64] ${SALTSTACK_REPO}" > /etc/apt/sources.list.d/saltstack.list |
| 13 | apt-get update |
| 14 | apt-get install git-core -y |
| 15 | for g_host in ${CLUSTER_MODEL} ${GIT_SALT_FORMULAS_SCRIPTS} ; do |
| 16 | _tmp_host=$(echo ${g_host} | awk -F/ '{print $3}') |
| 17 | ssh-keyscan -T 1 -H ${_tmp_host} >> ~/.ssh/known_hosts || true |
| 18 | done |
| 19 | |
| 20 | git clone --recursive -b ${CLUSTER_MODEL_REF} ${CLUSTER_MODEL} /srv/salt/reclass || true |
| 21 | git clone ${GIT_SALT_FORMULAS_SCRIPTS} /srv/salt/scripts || true |
| 22 | # bootstrap.sh opts |
| 23 | export FORMULAS_SOURCE=pkg |
| 24 | export HOSTNAME=apt01 |
| 25 | export DOMAIN="${CLUSTER_NAME}.local" |
| 26 | export EXTRA_FORMULAS="ntp aptly nginx iptables docker" |
| 27 | export APT_REPOSITORY=" deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO} " |
| 28 | export APT_REPOSITORY_GPG=${APT_MIRANTIS_GPG} |
| 29 | if [[ ! -z "${PACKER_OFFLINE_BUILD}" ]];then |
| 30 | echo "offline detected!" |
| 31 | export BOOTSTRAP_SALTSTACK_COM="http://${PACKER_HTTP_ADDR}/bootstrap.saltstack.com.sh" |
| 32 | export BOOTSTRAP_SALTSTACK_OPTS=${BOOTSTRAP_SALTSTACK_OPTS:- -dXr $BOOTSTRAP_SALTSTACK_VERSION } |
| 33 | fi |
| 34 | # |
| 35 | bash -x /srv/salt/scripts/bootstrap.sh || true |