Fatih Degirmenci | becbba0 | 2019-02-25 00:37:19 +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 | 4f868b9 | 2020-06-24 13:20:30 +0000 | [diff] [blame] | 24 | #------------------------------------------------------------------------------- |
| 25 | # Find and set where we are |
| 26 | #------------------------------------------------------------------------------- |
Fatih Degirmenci | 45956ac | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 27 | INSTALLER_ROOT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" |
Fatih Degirmenci | 4f868b9 | 2020-06-24 13:20:30 +0000 | [diff] [blame] | 28 | |
Fatih Degirmenci | becbba0 | 2019-02-25 00:37:19 +0000 | [diff] [blame] | 29 | 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" |
| 30 | export ANSIBLE_LIBRARY="$HOME/.ansible/plugins/modules:/usr/share/ansible/plugins/modules:${ENGINE_CACHE}/repos/bifrost/playbooks/library" |
| 31 | |
| 32 | # configure target hosts |
| 33 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | ae729c1 | 2020-02-27 06:39:30 +0000 | [diff] [blame] | 34 | echo "Info : Configure target hosts" |
Fatih Degirmenci | becbba0 | 2019-02-25 00:37:19 +0000 | [diff] [blame] | 35 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 45956ac | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 36 | cd "${ENGINE_PATH}" |
Sriram Yagnaraman | 1abbc26 | 2019-12-25 01:40:00 +0000 | [diff] [blame] | 37 | ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \ |
Fatih Degirmenci | 71e0ebc | 2020-01-09 07:26:08 +0000 | [diff] [blame] | 38 | -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \ |
| 39 | "${INSTALLER_ROOT_DIR}/playbooks/configure-targethosts.yml" |
Fatih Degirmenci | becbba0 | 2019-02-25 00:37:19 +0000 | [diff] [blame] | 40 | |
Fatih Degirmenci | ccc6889 | 2019-02-27 09:16:45 +0000 | [diff] [blame] | 41 | # configure installer |
| 42 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | ae729c1 | 2020-02-27 06:39:30 +0000 | [diff] [blame] | 43 | echo "Info : Configure installer" |
Fatih Degirmenci | ccc6889 | 2019-02-27 09:16:45 +0000 | [diff] [blame] | 44 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 45956ac | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 45 | cd "${ENGINE_PATH}" |
Sriram Yagnaraman | 1abbc26 | 2019-12-25 01:40:00 +0000 | [diff] [blame] | 46 | ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \ |
Fatih Degirmenci | 71e0ebc | 2020-01-09 07:26:08 +0000 | [diff] [blame] | 47 | -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \ |
| 48 | "${INSTALLER_ROOT_DIR}/playbooks/configure-installer.yml" |
Fatih Degirmenci | ccc6889 | 2019-02-27 09:16:45 +0000 | [diff] [blame] | 49 | |
Fatih Degirmenci | 4fdfaef | 2020-05-19 08:49:27 +0000 | [diff] [blame] | 50 | # run scenario pre-deployment tasks |
Fatih Degirmenci | 18c7c31 | 2019-04-09 16:44:45 +0000 | [diff] [blame] | 51 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 4f868b9 | 2020-06-24 13:20:30 +0000 | [diff] [blame] | 52 | echo "Info : Execute stack preinstall tasks" |
Fatih Degirmenci | 18c7c31 | 2019-04-09 16:44:45 +0000 | [diff] [blame] | 53 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 45956ac | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 54 | cd "${ENGINE_PATH}" |
Sriram Yagnaraman | 1abbc26 | 2019-12-25 01:40:00 +0000 | [diff] [blame] | 55 | ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \ |
Fatih Degirmenci | 71e0ebc | 2020-01-09 07:26:08 +0000 | [diff] [blame] | 56 | -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \ |
Fatih Degirmenci | 4fdfaef | 2020-05-19 08:49:27 +0000 | [diff] [blame] | 57 | --tags preinstall \ |
Fatih Degirmenci | 4f868b9 | 2020-06-24 13:20:30 +0000 | [diff] [blame] | 58 | "${STACK_ROOT_DIR}/scenarios/${DEPLOY_SCENARIO}.yaml" |
Fatih Degirmenci | 18c7c31 | 2019-04-09 16:44:45 +0000 | [diff] [blame] | 59 | |
Fatih Degirmenci | 4f868b9 | 2020-06-24 13:20:30 +0000 | [diff] [blame] | 60 | # install stack |
Fatih Degirmenci | 5812046 | 2019-02-27 14:29:45 +0000 | [diff] [blame] | 61 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 4f868b9 | 2020-06-24 13:20:30 +0000 | [diff] [blame] | 62 | echo "Info : Install stack ${STACK_TYPE} with scenario ${DEPLOY_SCENARIO}" |
Fatih Degirmenci | 5812046 | 2019-02-27 14:29:45 +0000 | [diff] [blame] | 63 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 45956ac | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 64 | cd "${ENGINE_CACHE}/repos/kubespray" |
Sriram Yagnaraman | 1abbc26 | 2019-12-25 01:40:00 +0000 | [diff] [blame] | 65 | ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \ |
Fatih Degirmenci | 71e0ebc | 2020-01-09 07:26:08 +0000 | [diff] [blame] | 66 | -i inventory/engine/inventory.ini \ |
Fatih Degirmenci | cd2ab35 | 2020-02-28 22:15:18 +0000 | [diff] [blame] | 67 | -e "@${ENGINE_CACHE}/config/kubespray-vars.yml" \ |
Fatih Degirmenci | 71e0ebc | 2020-01-09 07:26:08 +0000 | [diff] [blame] | 68 | --flush-cache \ |
| 69 | cluster.yml |
Fatih Degirmenci | 5812046 | 2019-02-27 14:29:45 +0000 | [diff] [blame] | 70 | |
Fatih Degirmenci | 4fdfaef | 2020-05-19 08:49:27 +0000 | [diff] [blame] | 71 | # run scenario post-deployment tasks |
Fatih Degirmenci | e799508 | 2019-03-24 20:49:21 +0000 | [diff] [blame] | 72 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 4f868b9 | 2020-06-24 13:20:30 +0000 | [diff] [blame] | 73 | echo "Info : Execute stack postinstall tasks" |
Fatih Degirmenci | e799508 | 2019-03-24 20:49:21 +0000 | [diff] [blame] | 74 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 45956ac | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 75 | cd "${ENGINE_PATH}" |
Sriram Yagnaraman | 1abbc26 | 2019-12-25 01:40:00 +0000 | [diff] [blame] | 76 | ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \ |
Fatih Degirmenci | 71e0ebc | 2020-01-09 07:26:08 +0000 | [diff] [blame] | 77 | -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \ |
Fatih Degirmenci | 4fdfaef | 2020-05-19 08:49:27 +0000 | [diff] [blame] | 78 | --tags postinstall \ |
Fatih Degirmenci | 4f868b9 | 2020-06-24 13:20:30 +0000 | [diff] [blame] | 79 | "${STACK_ROOT_DIR}/scenarios/${DEPLOY_SCENARIO}.yaml" |
Fatih Degirmenci | e799508 | 2019-03-24 20:49:21 +0000 | [diff] [blame] | 80 | |
Fatih Degirmenci | becbba0 | 2019-02-25 00:37:19 +0000 | [diff] [blame] | 81 | # vim: set ts=2 sw=2 expandtab: |