Petr Ospalý | 171a169 | 2018-12-18 13:23:55 +0100 | [diff] [blame] | 1 | #! /usr/bin/env bash |
| 2 | |
| 3 | # COPYRIGHT NOTICE STARTS HERE |
| 4 | # |
| 5 | # Copyright 2018 © Samsung Electronics Co., Ltd. |
| 6 | # |
| 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | # you may not use this file except in compliance with the License. |
| 9 | # You may obtain a copy of the License at |
| 10 | # |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | # |
| 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | # See the License for the specific language governing permissions and |
| 17 | # limitations under the License. |
| 18 | # |
| 19 | # COPYRIGHT NOTICE ENDS HERE |
| 20 | |
| 21 | |
| 22 | # fail fast |
| 23 | set -e |
| 24 | |
| 25 | # OS check |
| 26 | . /etc/os-release |
| 27 | OS_ID="${ID}" |
| 28 | |
| 29 | case "$OS_ID" in |
| 30 | centos) |
| 31 | ;; |
| 32 | rhel) |
| 33 | ;; |
| 34 | ubuntu) |
| 35 | ;; |
| 36 | *) |
| 37 | echo This OS is not supported: $OS_ID |
| 38 | exit 1 |
| 39 | ;; |
| 40 | esac |
| 41 | |
| 42 | # boilerplate |
| 43 | RELATIVE_PATH=./ # relative path from this script to 'common-functions.sh' |
| 44 | if [ "$IS_COMMON_FUNCTIONS_SOURCED" != YES ] ; then |
| 45 | SCRIPT_DIR=$(dirname "${0}") |
| 46 | LOCAL_PATH=$(readlink -f "$SCRIPT_DIR") |
| 47 | . "${LOCAL_PATH}"/"${RELATIVE_PATH}"/common-functions.sh |
| 48 | fi |
| 49 | |
| 50 | message info "Reading configuration" |
| 51 | get_configuration |
| 52 | if [ -z "$NODES_IPS" ] ; then |
| 53 | get_cfg_val "NODES_IPS" "Enter the public IPv4 addresses of kubernetes nodes separated by space," \ |
| 54 | "\n(for example: 10.0.0.2 10.0.0.3 ...): " |
| 55 | fi |
| 56 | |
| 57 | echo "Wait for nexus startup (1min)" |
| 58 | sleep 60 |
| 59 | |
| 60 | |
| 61 | # on install server |
| 62 | deploy_rancher |
| 63 | deploy_kubernetes "$OS_ID" |
| 64 | |
| 65 | echo "Setting up ONAP Local Repo on Kubernetes nodes" |
| 66 | for node in ${NODES_IPS} ; do |
| 67 | enable_remote_repo $node |
| 68 | done |
| 69 | |
| 70 | # setup NFS on nodes |
| 71 | assort_nodes_ips() { |
| 72 | nfs_server="$1" |
| 73 | shift |
| 74 | nfs_clients="$*" |
| 75 | } |
| 76 | assort_nodes_ips ${NODES_IPS} |
| 77 | if [ -n "${nfs_clients}" ]; then |
| 78 | echo "Setting up NFS" |
| 79 | remote_setup_nfs_server $OS_ID ${nfs_server} ${nfs_clients} |
| 80 | for node in ${nfs_clients} ; do |
| 81 | remote_setup_nfs_mount $OS_ID $node ${nfs_server} |
| 82 | done |
| 83 | else |
| 84 | echo "Only one node set. Skipping nfs configuration" |
| 85 | fi |
| 86 | |
| 87 | echo "Copy ansible packages for onap ansible-server" |
| 88 | for node in ${NODES_IPS} ; do |
| 89 | upload_ansible_pkgs $OS_ID $node |
| 90 | done |
| 91 | |
| 92 | # to nodes |
| 93 | for node in ${NODES_IPS} ; do |
| 94 | deploy_node $node $OS_ID |
| 95 | done |