Vamsi Savaram | b9979ff | 2019-07-18 09:32:33 +0000 | [diff] [blame] | 1 | #!/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 | |
| 20 | set -o errexit |
| 21 | set -o nounset |
| 22 | set -o pipefail |
| 23 | |
Fatih Degirmenci | abfef8c | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 24 | INSTALLER_ROOT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" |
Vamsi Savaram | 52abf12 | 2019-07-22 13:04:02 +0000 | [diff] [blame] | 25 | export ANSIBLE_ROLES_PATH="$HOME/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:${ENGINE_PATH}/engine/playbooks/roles:${ENGINE_CACHE}/repos/bifrost/playbooks/roles" |
| 26 | export ANSIBLE_LIBRARY="$HOME/.ansible/plugins/modules:/usr/share/ansible/plugins/modules:${ENGINE_CACHE}/repos/bifrost/playbooks/library" |
Vamsi Savaram | b9979ff | 2019-07-18 09:32:33 +0000 | [diff] [blame] | 27 | |
Vamsi Savaram | 52abf12 | 2019-07-22 13:04:02 +0000 | [diff] [blame] | 28 | # configure target hosts |
| 29 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 38851c6 | 2020-02-27 06:39:30 +0000 | [diff] [blame] | 30 | echo "Info : Configure target hosts" |
Vamsi Savaram | 52abf12 | 2019-07-22 13:04:02 +0000 | [diff] [blame] | 31 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | abfef8c | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 32 | cd "${ENGINE_PATH}" |
Sriram Yagnaraman | ab4753a | 2019-12-25 01:40:00 +0000 | [diff] [blame] | 33 | ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \ |
Fatih Degirmenci | f7ec526 | 2020-01-09 07:32:48 +0000 | [diff] [blame] | 34 | -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \ |
| 35 | "${INSTALLER_ROOT_DIR}/playbooks/configure-targethosts.yml" |
Vamsi Savaram | 52abf12 | 2019-07-22 13:04:02 +0000 | [diff] [blame] | 36 | |
Vamsi Savaram | aeaea6e | 2019-07-24 13:21:34 +0000 | [diff] [blame] | 37 | # configure kolla installer |
| 38 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 38851c6 | 2020-02-27 06:39:30 +0000 | [diff] [blame] | 39 | echo "Info : Configure kolla installer" |
Vamsi Savaram | aeaea6e | 2019-07-24 13:21:34 +0000 | [diff] [blame] | 40 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | abfef8c | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 41 | cd "${ENGINE_PATH}" |
Sriram Yagnaraman | ab4753a | 2019-12-25 01:40:00 +0000 | [diff] [blame] | 42 | ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \ |
Fatih Degirmenci | f7ec526 | 2020-01-09 07:32:48 +0000 | [diff] [blame] | 43 | -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \ |
| 44 | "${INSTALLER_ROOT_DIR}/playbooks/configure-installer.yml" |
Vamsi Savaram | aeaea6e | 2019-07-24 13:21:34 +0000 | [diff] [blame] | 45 | |
| 46 | # TODO: we need to run scenario pre-deployment tasks here in order to configure |
| 47 | # bootstrap scenario |
| 48 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 38851c6 | 2020-02-27 06:39:30 +0000 | [diff] [blame] | 49 | echo "Info : Execute scenario pre deployment tasks" |
Vamsi Savaram | aeaea6e | 2019-07-24 13:21:34 +0000 | [diff] [blame] | 50 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | abfef8c | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 51 | cd "${ENGINE_PATH}" |
Sriram Yagnaraman | ab4753a | 2019-12-25 01:40:00 +0000 | [diff] [blame] | 52 | ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \ |
Fatih Degirmenci | f7ec526 | 2020-01-09 07:32:48 +0000 | [diff] [blame] | 53 | -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \ |
| 54 | "${INSTALLER_ROOT_DIR}/playbooks/pre-deployment.yml" |
Vamsi Savaram | aeaea6e | 2019-07-24 13:21:34 +0000 | [diff] [blame] | 55 | |
| 56 | # kolla-ansible: bootstrap servers |
| 57 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 38851c6 | 2020-02-27 06:39:30 +0000 | [diff] [blame] | 58 | echo "Info : Kolla-ansible bootstrap servers" |
Vamsi Savaram | aeaea6e | 2019-07-24 13:21:34 +0000 | [diff] [blame] | 59 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | abfef8c | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 60 | cd "${ENGINE_CACHE}/repos/kolla-ansible/tools" |
Vamsi Savaram | f416c38 | 2019-08-09 14:27:06 +0000 | [diff] [blame] | 61 | ./kolla-ansible \ |
Fatih Degirmenci | f7ec526 | 2020-01-09 07:32:48 +0000 | [diff] [blame] | 62 | -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 Savaram | aeaea6e | 2019-07-24 13:21:34 +0000 | [diff] [blame] | 67 | |
Vamsi Savaram | 454c4bd | 2019-07-29 14:02:05 +0000 | [diff] [blame] | 68 | # kolla-ansible: prechecks |
| 69 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 38851c6 | 2020-02-27 06:39:30 +0000 | [diff] [blame] | 70 | echo "Info : Kolla-ansible prechecks" |
Vamsi Savaram | 454c4bd | 2019-07-29 14:02:05 +0000 | [diff] [blame] | 71 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | abfef8c | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 72 | cd "${ENGINE_CACHE}/repos/kolla-ansible/tools" |
Vamsi Savaram | f416c38 | 2019-08-09 14:27:06 +0000 | [diff] [blame] | 73 | ./kolla-ansible \ |
Fatih Degirmenci | f7ec526 | 2020-01-09 07:32:48 +0000 | [diff] [blame] | 74 | -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 Savaram | 454c4bd | 2019-07-29 14:02:05 +0000 | [diff] [blame] | 79 | |
| 80 | # kolla-ansible: deploy |
| 81 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 38851c6 | 2020-02-27 06:39:30 +0000 | [diff] [blame] | 82 | echo "Info : Kolla-ansible deploy" |
Vamsi Savaram | 454c4bd | 2019-07-29 14:02:05 +0000 | [diff] [blame] | 83 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | abfef8c | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 84 | cd "${ENGINE_CACHE}/repos/kolla-ansible/tools" |
Vamsi Savaram | f416c38 | 2019-08-09 14:27:06 +0000 | [diff] [blame] | 85 | ./kolla-ansible \ |
Fatih Degirmenci | f7ec526 | 2020-01-09 07:32:48 +0000 | [diff] [blame] | 86 | -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 Savaram | 454c4bd | 2019-07-29 14:02:05 +0000 | [diff] [blame] | 91 | |
| 92 | # kolla-ansible: post-deploy |
| 93 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 38851c6 | 2020-02-27 06:39:30 +0000 | [diff] [blame] | 94 | echo "Info : Kolla-ansible post-deploy" |
Vamsi Savaram | 454c4bd | 2019-07-29 14:02:05 +0000 | [diff] [blame] | 95 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | abfef8c | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 96 | cd "${ENGINE_CACHE}/repos/kolla-ansible/tools" |
Vamsi Savaram | f416c38 | 2019-08-09 14:27:06 +0000 | [diff] [blame] | 97 | ./kolla-ansible \ |
Fatih Degirmenci | f7ec526 | 2020-01-09 07:32:48 +0000 | [diff] [blame] | 98 | -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 Savaram | aeaea6e | 2019-07-24 13:21:34 +0000 | [diff] [blame] | 103 | |
Fatih Degirmenci | abfef8c | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 104 | # NOTE: shellcheck SC1090 is disabled since openrc file is put in place during runtime |
| 105 | # shellcheck disable=SC1090 |
Vamsi Savaram | daad405 | 2019-08-22 14:32:43 +0000 | [diff] [blame] | 106 | # source admin-openrc.sh for running post-deployment tasks |
Fatih Degirmenci | abfef8c | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 107 | source "${ENGINE_CACHE}/config/admin-openrc.sh" |
Vamsi Savaram | daad405 | 2019-08-22 14:32:43 +0000 | [diff] [blame] | 108 | |
Vamsi Savaram | aeaea6e | 2019-07-24 13:21:34 +0000 | [diff] [blame] | 109 | # run post-deployment tasks |
| 110 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 38851c6 | 2020-02-27 06:39:30 +0000 | [diff] [blame] | 111 | echo "Info : Execute scenario and common post deployment tasks" |
Vamsi Savaram | aeaea6e | 2019-07-24 13:21:34 +0000 | [diff] [blame] | 112 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | abfef8c | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 113 | cd "${ENGINE_PATH}" |
Sriram Yagnaraman | ab4753a | 2019-12-25 01:40:00 +0000 | [diff] [blame] | 114 | ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \ |
Fatih Degirmenci | f7ec526 | 2020-01-09 07:32:48 +0000 | [diff] [blame] | 115 | -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \ |
| 116 | "${INSTALLER_ROOT_DIR}/playbooks/post-deployment.yml" |
Vamsi Savaram | aeaea6e | 2019-07-24 13:21:34 +0000 | [diff] [blame] | 117 | |
Vamsi Savaram | 52abf12 | 2019-07-22 13:04:02 +0000 | [diff] [blame] | 118 | # vim: set ts=2 sw=2 expandtab: |