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 | 45956ac | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 24 | INSTALLER_ROOT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" |
Fatih Degirmenci | becbba0 | 2019-02-25 00:37:19 +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" |
| 27 | |
| 28 | # configure target hosts |
| 29 | echo "-------------------------------------------------------------------------" |
| 30 | echo "Info: Configure target hosts" |
| 31 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 45956ac | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 32 | cd "${ENGINE_PATH}" |
Sriram Yagnaraman | 1abbc26 | 2019-12-25 01:40:00 +0000 | [diff] [blame] | 33 | ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \ |
Fatih Degirmenci | 71e0ebc | 2020-01-09 07:26:08 +0000 | [diff] [blame] | 34 | -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \ |
| 35 | "${INSTALLER_ROOT_DIR}/playbooks/configure-targethosts.yml" |
Fatih Degirmenci | becbba0 | 2019-02-25 00:37:19 +0000 | [diff] [blame] | 36 | |
Fatih Degirmenci | ccc6889 | 2019-02-27 09:16:45 +0000 | [diff] [blame] | 37 | # configure installer |
| 38 | echo "-------------------------------------------------------------------------" |
| 39 | echo "Info: Configure installer" |
| 40 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 45956ac | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 41 | cd "${ENGINE_PATH}" |
Sriram Yagnaraman | 1abbc26 | 2019-12-25 01:40:00 +0000 | [diff] [blame] | 42 | ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \ |
Fatih Degirmenci | 71e0ebc | 2020-01-09 07:26:08 +0000 | [diff] [blame] | 43 | -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \ |
| 44 | "${INSTALLER_ROOT_DIR}/playbooks/configure-installer.yml" |
Fatih Degirmenci | ccc6889 | 2019-02-27 09:16:45 +0000 | [diff] [blame] | 45 | |
Fatih Degirmenci | 18c7c31 | 2019-04-09 16:44:45 +0000 | [diff] [blame] | 46 | # bootstrap scenario |
| 47 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 73175db | 2019-07-16 07:49:01 +0000 | [diff] [blame] | 48 | echo "Info: Execute scenario pre deployment tasks" |
Fatih Degirmenci | 18c7c31 | 2019-04-09 16:44:45 +0000 | [diff] [blame] | 49 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 45956ac | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 50 | cd "${ENGINE_PATH}" |
Sriram Yagnaraman | 1abbc26 | 2019-12-25 01:40:00 +0000 | [diff] [blame] | 51 | ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \ |
Fatih Degirmenci | 71e0ebc | 2020-01-09 07:26:08 +0000 | [diff] [blame] | 52 | -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \ |
| 53 | "${INSTALLER_ROOT_DIR}/playbooks/pre-deployment.yml" |
Fatih Degirmenci | 18c7c31 | 2019-04-09 16:44:45 +0000 | [diff] [blame] | 54 | |
Fatih Degirmenci | 3646fcd | 2019-06-12 16:21:11 +0200 | [diff] [blame] | 55 | # install scenario |
Fatih Degirmenci | 5812046 | 2019-02-27 14:29:45 +0000 | [diff] [blame] | 56 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 3646fcd | 2019-06-12 16:21:11 +0200 | [diff] [blame] | 57 | echo "Info: Install scenario ${DEPLOY_SCENARIO}" |
Fatih Degirmenci | 5812046 | 2019-02-27 14:29:45 +0000 | [diff] [blame] | 58 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 45956ac | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 59 | cd "${ENGINE_CACHE}/repos/kubespray" |
Sriram Yagnaraman | 1abbc26 | 2019-12-25 01:40:00 +0000 | [diff] [blame] | 60 | ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \ |
Fatih Degirmenci | 71e0ebc | 2020-01-09 07:26:08 +0000 | [diff] [blame] | 61 | -i inventory/engine/inventory.ini \ |
| 62 | -e "@${ENGINE_CACHE}/config/kubespray-extra-vars.yml" \ |
| 63 | --flush-cache \ |
| 64 | cluster.yml |
Fatih Degirmenci | 5812046 | 2019-02-27 14:29:45 +0000 | [diff] [blame] | 65 | |
Fatih Degirmenci | e799508 | 2019-03-24 20:49:21 +0000 | [diff] [blame] | 66 | # run post-deployment tasks |
| 67 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 73175db | 2019-07-16 07:49:01 +0000 | [diff] [blame] | 68 | echo "Info: Execute scenario and common post deployment tasks" |
Fatih Degirmenci | e799508 | 2019-03-24 20:49:21 +0000 | [diff] [blame] | 69 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 45956ac | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 70 | cd "${ENGINE_PATH}" |
Sriram Yagnaraman | 1abbc26 | 2019-12-25 01:40:00 +0000 | [diff] [blame] | 71 | ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \ |
Fatih Degirmenci | 71e0ebc | 2020-01-09 07:26:08 +0000 | [diff] [blame] | 72 | -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \ |
| 73 | "${INSTALLER_ROOT_DIR}/playbooks/post-deployment.yml" |
Fatih Degirmenci | e799508 | 2019-03-24 20:49:21 +0000 | [diff] [blame] | 74 | |
Fatih Degirmenci | becbba0 | 2019-02-25 00:37:19 +0000 | [diff] [blame] | 75 | # vim: set ts=2 sw=2 expandtab: |