blob: f2a77be1eb93c643184bdbd177f69a82790950a0 [file] [log] [blame]
Petr Ospalý171a1692018-12-18 13:23:55 +01001#! /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
23set -e
24
25# OS check
26. /etc/os-release
27OS_ID="${ID}"
28
29case "$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 ;;
40esac
41
42# boilerplate
43RELATIVE_PATH=./ # relative path from this script to 'common-functions.sh'
44if [ "$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
48fi
49
50message info "Reading configuration"
51get_configuration
52if [ -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 ...): "
55fi
56
57echo "Wait for nexus startup (1min)"
58sleep 60
59
60
61# on install server
62deploy_rancher
63deploy_kubernetes "$OS_ID"
64
65echo "Setting up ONAP Local Repo on Kubernetes nodes"
66for node in ${NODES_IPS} ; do
67 enable_remote_repo $node
68done
69
70# setup NFS on nodes
71assort_nodes_ips() {
72 nfs_server="$1"
73 shift
74 nfs_clients="$*"
75}
76assort_nodes_ips ${NODES_IPS}
77if [ -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
83else
84 echo "Only one node set. Skipping nfs configuration"
85fi
86
87echo "Copy ansible packages for onap ansible-server"
88for node in ${NODES_IPS} ; do
89 upload_ansible_pkgs $OS_ID $node
90done
91
92# to nodes
93for node in ${NODES_IPS} ; do
94 deploy_node $node $OS_ID
95done