blob: d38b4c2729ff0dbc06cb8913e5da19030956bedc [file] [log] [blame]
Fatih Degirmencibecbba02019-02-25 00:37:19 +00001#!/bin/bash
2# ============LICENSE_START=======================================================
3# Copyright (C) 2019 The Nordix Foundation. All rights reserved.
4# ================================================================================
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17# SPDX-License-Identifier: Apache-2.0
18# ============LICENSE_END=========================================================
19
20set -o errexit
21set -o nounset
22set -o pipefail
23
Fatih Degirmenci4f868b92020-06-24 13:20:30 +000024#-------------------------------------------------------------------------------
25# Find and set where we are
26#-------------------------------------------------------------------------------
Fatih Degirmenci45956ac2019-12-16 10:53:15 +010027INSTALLER_ROOT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
Fatih Degirmenci4f868b92020-06-24 13:20:30 +000028
Fatih Degirmencibecbba02019-02-25 00:37:19 +000029export ANSIBLE_ROLES_PATH="$HOME/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:${ENGINE_PATH}/engine/playbooks/roles:${ENGINE_CACHE}/repos/bifrost/playbooks/roles"
30export ANSIBLE_LIBRARY="$HOME/.ansible/plugins/modules:/usr/share/ansible/plugins/modules:${ENGINE_CACHE}/repos/bifrost/playbooks/library"
31
32# configure target hosts
33echo "-------------------------------------------------------------------------"
Fatih Degirmenciae729c12020-02-27 06:39:30 +000034echo "Info : Configure target hosts"
Fatih Degirmencibecbba02019-02-25 00:37:19 +000035echo "-------------------------------------------------------------------------"
Fatih Degirmenci45956ac2019-12-16 10:53:15 +010036cd "${ENGINE_PATH}"
Sriram Yagnaraman1abbc262019-12-25 01:40:00 +000037ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \
Fatih Degirmenci71e0ebc2020-01-09 07:26:08 +000038 -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \
39 "${INSTALLER_ROOT_DIR}/playbooks/configure-targethosts.yml"
Fatih Degirmencibecbba02019-02-25 00:37:19 +000040
Fatih Degirmenciccc68892019-02-27 09:16:45 +000041# configure installer
42echo "-------------------------------------------------------------------------"
Fatih Degirmenciae729c12020-02-27 06:39:30 +000043echo "Info : Configure installer"
Fatih Degirmenciccc68892019-02-27 09:16:45 +000044echo "-------------------------------------------------------------------------"
Fatih Degirmenci45956ac2019-12-16 10:53:15 +010045cd "${ENGINE_PATH}"
Sriram Yagnaraman1abbc262019-12-25 01:40:00 +000046ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \
Fatih Degirmenci71e0ebc2020-01-09 07:26:08 +000047 -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \
48 "${INSTALLER_ROOT_DIR}/playbooks/configure-installer.yml"
Fatih Degirmenciccc68892019-02-27 09:16:45 +000049
Fatih Degirmenci4fdfaef2020-05-19 08:49:27 +000050# run scenario pre-deployment tasks
Fatih Degirmenci18c7c312019-04-09 16:44:45 +000051echo "-------------------------------------------------------------------------"
Fatih Degirmenci4f868b92020-06-24 13:20:30 +000052echo "Info : Execute stack preinstall tasks"
Fatih Degirmenci18c7c312019-04-09 16:44:45 +000053echo "-------------------------------------------------------------------------"
Fatih Degirmenci45956ac2019-12-16 10:53:15 +010054cd "${ENGINE_PATH}"
Sriram Yagnaraman1abbc262019-12-25 01:40:00 +000055ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \
Fatih Degirmenci71e0ebc2020-01-09 07:26:08 +000056 -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \
Fatih Degirmenci4fdfaef2020-05-19 08:49:27 +000057 --tags preinstall \
Fatih Degirmenci4f868b92020-06-24 13:20:30 +000058 "${STACK_ROOT_DIR}/scenarios/${DEPLOY_SCENARIO}.yaml"
Fatih Degirmenci18c7c312019-04-09 16:44:45 +000059
Fatih Degirmenci4f868b92020-06-24 13:20:30 +000060# install stack
Fatih Degirmenci58120462019-02-27 14:29:45 +000061echo "-------------------------------------------------------------------------"
Fatih Degirmenci4f868b92020-06-24 13:20:30 +000062echo "Info : Install stack ${STACK_TYPE} with scenario ${DEPLOY_SCENARIO}"
Fatih Degirmenci58120462019-02-27 14:29:45 +000063echo "-------------------------------------------------------------------------"
Fatih Degirmenci45956ac2019-12-16 10:53:15 +010064cd "${ENGINE_CACHE}/repos/kubespray"
Sriram Yagnaraman1abbc262019-12-25 01:40:00 +000065ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \
Fatih Degirmenci71e0ebc2020-01-09 07:26:08 +000066 -i inventory/engine/inventory.ini \
Fatih Degirmencicd2ab352020-02-28 22:15:18 +000067 -e "@${ENGINE_CACHE}/config/kubespray-vars.yml" \
Fatih Degirmenci71e0ebc2020-01-09 07:26:08 +000068 --flush-cache \
69 cluster.yml
Fatih Degirmenci58120462019-02-27 14:29:45 +000070
Fatih Degirmenci4fdfaef2020-05-19 08:49:27 +000071# run scenario post-deployment tasks
Fatih Degirmencie7995082019-03-24 20:49:21 +000072echo "-------------------------------------------------------------------------"
Fatih Degirmenci4f868b92020-06-24 13:20:30 +000073echo "Info : Execute stack postinstall tasks"
Fatih Degirmencie7995082019-03-24 20:49:21 +000074echo "-------------------------------------------------------------------------"
Fatih Degirmenci45956ac2019-12-16 10:53:15 +010075cd "${ENGINE_PATH}"
Sriram Yagnaraman1abbc262019-12-25 01:40:00 +000076ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \
Fatih Degirmenci71e0ebc2020-01-09 07:26:08 +000077 -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \
Fatih Degirmenci4fdfaef2020-05-19 08:49:27 +000078 --tags postinstall \
Fatih Degirmenci4f868b92020-06-24 13:20:30 +000079 "${STACK_ROOT_DIR}/scenarios/${DEPLOY_SCENARIO}.yaml"
Fatih Degirmencie7995082019-03-24 20:49:21 +000080
Fatih Degirmencibecbba02019-02-25 00:37:19 +000081# vim: set ts=2 sw=2 expandtab: