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 "-------------------------------------------------------------------------" |
Fatih Degirmenci | ae729c1 | 2020-02-27 06:39:30 +0000 | [diff] [blame] | 30 | echo "Info : Configure target hosts" |
Fatih Degirmenci | becbba0 | 2019-02-25 00:37:19 +0000 | [diff] [blame] | 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 "-------------------------------------------------------------------------" |
Fatih Degirmenci | ae729c1 | 2020-02-27 06:39:30 +0000 | [diff] [blame] | 39 | echo "Info : Configure installer" |
Fatih Degirmenci | ccc6889 | 2019-02-27 09:16:45 +0000 | [diff] [blame] | 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 | 4fdfaef | 2020-05-19 08:49:27 +0000 | [diff] [blame^] | 46 | # run scenario pre-deployment tasks |
Fatih Degirmenci | 18c7c31 | 2019-04-09 16:44:45 +0000 | [diff] [blame] | 47 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 4fdfaef | 2020-05-19 08:49:27 +0000 | [diff] [blame^] | 48 | echo "Info : Execute scenario preinstall 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" \ |
Fatih Degirmenci | 4fdfaef | 2020-05-19 08:49:27 +0000 | [diff] [blame^] | 53 | --tags preinstall \ |
| 54 | "${INSTALLER_ROOT_DIR}/playbooks/scenarios/${DEPLOY_SCENARIO}.yaml" |
Fatih Degirmenci | 18c7c31 | 2019-04-09 16:44:45 +0000 | [diff] [blame] | 55 | |
Fatih Degirmenci | 3646fcd | 2019-06-12 16:21:11 +0200 | [diff] [blame] | 56 | # install scenario |
Fatih Degirmenci | 5812046 | 2019-02-27 14:29:45 +0000 | [diff] [blame] | 57 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | ae729c1 | 2020-02-27 06:39:30 +0000 | [diff] [blame] | 58 | echo "Info : Install scenario ${DEPLOY_SCENARIO}" |
Fatih Degirmenci | 5812046 | 2019-02-27 14:29:45 +0000 | [diff] [blame] | 59 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 45956ac | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 60 | cd "${ENGINE_CACHE}/repos/kubespray" |
Sriram Yagnaraman | 1abbc26 | 2019-12-25 01:40:00 +0000 | [diff] [blame] | 61 | ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \ |
Fatih Degirmenci | 71e0ebc | 2020-01-09 07:26:08 +0000 | [diff] [blame] | 62 | -i inventory/engine/inventory.ini \ |
Fatih Degirmenci | cd2ab35 | 2020-02-28 22:15:18 +0000 | [diff] [blame] | 63 | -e "@${ENGINE_CACHE}/config/kubespray-vars.yml" \ |
Fatih Degirmenci | 71e0ebc | 2020-01-09 07:26:08 +0000 | [diff] [blame] | 64 | --flush-cache \ |
| 65 | cluster.yml |
Fatih Degirmenci | 5812046 | 2019-02-27 14:29:45 +0000 | [diff] [blame] | 66 | |
Fatih Degirmenci | 4fdfaef | 2020-05-19 08:49:27 +0000 | [diff] [blame^] | 67 | # run scenario post-deployment tasks |
Fatih Degirmenci | e799508 | 2019-03-24 20:49:21 +0000 | [diff] [blame] | 68 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 4fdfaef | 2020-05-19 08:49:27 +0000 | [diff] [blame^] | 69 | echo "Info : Execute scenario postinstall tasks" |
Fatih Degirmenci | e799508 | 2019-03-24 20:49:21 +0000 | [diff] [blame] | 70 | echo "-------------------------------------------------------------------------" |
Fatih Degirmenci | 45956ac | 2019-12-16 10:53:15 +0100 | [diff] [blame] | 71 | cd "${ENGINE_PATH}" |
Sriram Yagnaraman | 1abbc26 | 2019-12-25 01:40:00 +0000 | [diff] [blame] | 72 | ansible-playbook "${ENGINE_ANSIBLE_PARAMS[@]}" \ |
Fatih Degirmenci | 71e0ebc | 2020-01-09 07:26:08 +0000 | [diff] [blame] | 73 | -i "${ENGINE_PATH}/engine/inventory/inventory.ini" \ |
Fatih Degirmenci | 4fdfaef | 2020-05-19 08:49:27 +0000 | [diff] [blame^] | 74 | --tags postinstall \ |
| 75 | "${INSTALLER_ROOT_DIR}/playbooks/scenarios/${DEPLOY_SCENARIO}.yaml" |
Fatih Degirmenci | e799508 | 2019-03-24 20:49:21 +0000 | [diff] [blame] | 76 | |
Fatih Degirmenci | becbba0 | 2019-02-25 00:37:19 +0000 | [diff] [blame] | 77 | # vim: set ts=2 sw=2 expandtab: |