blob: 73e27daa9e821f9f11e945af6e7c9e64640f6b3b [file] [log] [blame]
Vamsi Savaramb9979ff2019-07-18 09:32:33 +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 Degirmenciabfef8c2019-12-16 10:53:15 +010024INSTALLER_ROOT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
Vamsi Savaram52abf122019-07-22 13:04:02 +000025export ANSIBLE_ROLES_PATH="$HOME/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:${ENGINE_PATH}/engine/playbooks/roles:${ENGINE_CACHE}/repos/bifrost/playbooks/roles"
26export ANSIBLE_LIBRARY="$HOME/.ansible/plugins/modules:/usr/share/ansible/plugins/modules:${ENGINE_CACHE}/repos/bifrost/playbooks/library"
Vamsi Savaramb9979ff2019-07-18 09:32:33 +000027
Vamsi Savaram52abf122019-07-22 13:04:02 +000028# configure target hosts
29echo "-------------------------------------------------------------------------"
30echo "Info: Configure target hosts"
31echo "-------------------------------------------------------------------------"
Fatih Degirmenciabfef8c2019-12-16 10:53:15 +010032cd "${ENGINE_PATH}"
Sriram Yagnaramanab4753a2019-12-25 01:40:00 +000033ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \
Fatih Degirmencif7ec5262020-01-09 07:32:48 +000034 -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \
35 "${INSTALLER_ROOT_DIR}/playbooks/configure-targethosts.yml"
Vamsi Savaram52abf122019-07-22 13:04:02 +000036
Vamsi Savaramaeaea6e2019-07-24 13:21:34 +000037# configure kolla installer
38echo "-------------------------------------------------------------------------"
39echo "Info: Configure kolla installer"
40echo "-------------------------------------------------------------------------"
Fatih Degirmenciabfef8c2019-12-16 10:53:15 +010041cd "${ENGINE_PATH}"
Sriram Yagnaramanab4753a2019-12-25 01:40:00 +000042ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \
Fatih Degirmencif7ec5262020-01-09 07:32:48 +000043 -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \
44 "${INSTALLER_ROOT_DIR}/playbooks/configure-installer.yml"
Vamsi Savaramaeaea6e2019-07-24 13:21:34 +000045
46# TODO: we need to run scenario pre-deployment tasks here in order to configure
47# bootstrap scenario
48echo "-------------------------------------------------------------------------"
49echo "Info: Execute scenario pre deployment tasks"
50echo "-------------------------------------------------------------------------"
Fatih Degirmenciabfef8c2019-12-16 10:53:15 +010051cd "${ENGINE_PATH}"
Sriram Yagnaramanab4753a2019-12-25 01:40:00 +000052ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \
Fatih Degirmencif7ec5262020-01-09 07:32:48 +000053 -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \
54 "${INSTALLER_ROOT_DIR}/playbooks/pre-deployment.yml"
Vamsi Savaramaeaea6e2019-07-24 13:21:34 +000055
56# kolla-ansible: bootstrap servers
57echo "-------------------------------------------------------------------------"
Vamsi Savaram454c4bd2019-07-29 14:02:05 +000058echo "Info: Kolla-ansible bootstrap servers"
Vamsi Savaramaeaea6e2019-07-24 13:21:34 +000059echo "-------------------------------------------------------------------------"
Fatih Degirmenciabfef8c2019-12-16 10:53:15 +010060cd "${ENGINE_CACHE}/repos/kolla-ansible/tools"
Vamsi Savaramf416c382019-08-09 14:27:06 +000061./kolla-ansible \
Fatih Degirmencif7ec5262020-01-09 07:32:48 +000062 -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \
63 --configdir "${ENGINE_CACHE}/config" \
64 --passwords "${ENGINE_CACHE}/config/passwords.yml" \
65 -e "@${ENGINE_CACHE}/config/kolla-ansible-extra-vars.yml" \
66 bootstrap-servers
Vamsi Savaramaeaea6e2019-07-24 13:21:34 +000067
Vamsi Savaram454c4bd2019-07-29 14:02:05 +000068# kolla-ansible: prechecks
69echo "-------------------------------------------------------------------------"
70echo "Info: Kolla-ansible prechecks"
71echo "-------------------------------------------------------------------------"
Fatih Degirmenciabfef8c2019-12-16 10:53:15 +010072cd "${ENGINE_CACHE}/repos/kolla-ansible/tools"
Vamsi Savaramf416c382019-08-09 14:27:06 +000073./kolla-ansible \
Fatih Degirmencif7ec5262020-01-09 07:32:48 +000074 -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \
75 --configdir "${ENGINE_CACHE}/config" \
76 --passwords "${ENGINE_CACHE}/config/passwords.yml" \
77 -e "@${ENGINE_CACHE}/config/kolla-ansible-extra-vars.yml" \
78 prechecks
Vamsi Savaram454c4bd2019-07-29 14:02:05 +000079
80# kolla-ansible: deploy
81echo "-------------------------------------------------------------------------"
82echo "Info: Kolla-ansible deploy"
83echo "-------------------------------------------------------------------------"
Fatih Degirmenciabfef8c2019-12-16 10:53:15 +010084cd "${ENGINE_CACHE}/repos/kolla-ansible/tools"
Vamsi Savaramf416c382019-08-09 14:27:06 +000085./kolla-ansible \
Fatih Degirmencif7ec5262020-01-09 07:32:48 +000086 -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \
87 --configdir "${ENGINE_CACHE}/config" \
88 --passwords "${ENGINE_CACHE}/config/passwords.yml" \
89 -e "@${ENGINE_CACHE}/config/kolla-ansible-extra-vars.yml" \
90 deploy
Vamsi Savaram454c4bd2019-07-29 14:02:05 +000091
92# kolla-ansible: post-deploy
93echo "-------------------------------------------------------------------------"
94echo "Info: Kolla-ansible post-deploy"
95echo "-------------------------------------------------------------------------"
Fatih Degirmenciabfef8c2019-12-16 10:53:15 +010096cd "${ENGINE_CACHE}/repos/kolla-ansible/tools"
Vamsi Savaramf416c382019-08-09 14:27:06 +000097./kolla-ansible \
Fatih Degirmencif7ec5262020-01-09 07:32:48 +000098 -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \
99 --configdir "${ENGINE_CACHE}/config" \
100 --passwords "${ENGINE_CACHE}/config/passwords.yml" \
101 -e "@${ENGINE_CACHE}/config/kolla-ansible-extra-vars.yml" \
102 post-deploy
Vamsi Savaramaeaea6e2019-07-24 13:21:34 +0000103
Fatih Degirmenciabfef8c2019-12-16 10:53:15 +0100104# NOTE: shellcheck SC1090 is disabled since openrc file is put in place during runtime
105# shellcheck disable=SC1090
Vamsi Savaramdaad4052019-08-22 14:32:43 +0000106# source admin-openrc.sh for running post-deployment tasks
Fatih Degirmenciabfef8c2019-12-16 10:53:15 +0100107source "${ENGINE_CACHE}/config/admin-openrc.sh"
Vamsi Savaramdaad4052019-08-22 14:32:43 +0000108
Vamsi Savaramaeaea6e2019-07-24 13:21:34 +0000109# run post-deployment tasks
110echo "-------------------------------------------------------------------------"
111echo "Info: Execute scenario and common post deployment tasks"
112echo "-------------------------------------------------------------------------"
Fatih Degirmenciabfef8c2019-12-16 10:53:15 +0100113cd "${ENGINE_PATH}"
Sriram Yagnaramanab4753a2019-12-25 01:40:00 +0000114ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \
Fatih Degirmencif7ec5262020-01-09 07:32:48 +0000115 -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \
116 "${INSTALLER_ROOT_DIR}/playbooks/post-deployment.yml"
Vamsi Savaramaeaea6e2019-07-24 13:21:34 +0000117
Vamsi Savaram52abf122019-07-22 13:04:02 +0000118# vim: set ts=2 sw=2 expandtab: