automated few manual steps
[kuberef.git] / deploy.sh
index 2b1e3ce..b2426b3 100755 (executable)
--- a/deploy.sh
+++ b/deploy.sh
@@ -1,16 +1,14 @@
 #!/bin/bash
-# SPDX-license-identifier: Apache-2.0
-##############################################################################
-# Copyright (c) Ericsson AB and others
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
 
-set -o xtrace
+# SPDX-FileCopyrightText: 2021 Ericsson AB and others
+#
+# SPDX-License-Identifier: Apache-2.0
+
 set -o errexit
 set -o nounset
+if [ "${DEBUG:-false}" == "true" ]; then
+    set -o xtrace
+fi
 
 # Script for end to end RI-2 deployment using Infra engine and BMRA.
 # Please refer to README for detailed information.
@@ -19,34 +17,35 @@ set -o nounset
 CURRENTPATH=$(git rev-parse --show-toplevel)
 export CURRENTPATH
 
-# Source env variables & functions
-# shellcheck source=./deploy.env
-source "$CURRENTPATH/deploy.env"
 # shellcheck source=./functions.sh
 source "$CURRENTPATH/functions.sh"
+# shellcheck source=./deploy.env
+source "$CURRENTPATH/deploy.env"
 
 # ---------------------------------------------------------------------
 # check installation and runtime prerequisites
 # ---------------------------------------------------------------------
 check_prerequisites
 
+# ---------------------------------------------------------------------
+# creates a virtual environment for installation of dependencies
+# ---------------------------------------------------------------------
+creates_virtualenv
+
 # ---------------------------------------------------------------------
 # bootstrap install prerequisites
 # ---------------------------------------------------------------------
-ansible-playbook -i "$CURRENTPATH"/inventory/localhost.ini \
-    "$CURRENTPATH"/playbooks/bootstrap.yaml
+run_playbook bootstrap
 
 # ---------------------------------------------------------------------
 # Create jump VM from which the installation is performed
 # ---------------------------------------------------------------------
-ansible-playbook -i "$CURRENTPATH"/inventory/localhost.ini \
-    "$CURRENTPATH"/playbooks/jump-vm.yaml
+run_playbook jump-vm
 
 # ---------------------------------------------------------------------
 # Create BMRA config based on IDF and PDF
 # ---------------------------------------------------------------------
-ansible-playbook -i "$CURRENTPATH"/inventory/localhost.ini \
-    "$CURRENTPATH"/playbooks/bmra-config.yaml
+run_playbook bmra-config
 
 # ---------------------------------------------------------------------
 # Copy files needed by Infra engine & BMRA in the jumphost VM
@@ -55,15 +54,20 @@ copy_files_jump
 
 # ---------------------------------------------------------------------
 # Provision remote hosts
+# Setup networking (Adapt according to your network setup)
 # ---------------------------------------------------------------------
-provision_hosts
+if [[ "$DEPLOYMENT" == "full" ]]; then
+    provision_hosts_baremetal
+    setup_network
+fi
 
 # ---------------------------------------------------------------------
-# Setup networking (Adapt according to your network setup)
+# Provision k8s cluster (currently BMRA)
 # ---------------------------------------------------------------------
-setup_network
+provision_k8s_baremetal
 
 # ---------------------------------------------------------------------
-# Provision k8s cluster (currently BMRA)
+# Copy kubeconfig to desired location
 # ---------------------------------------------------------------------
-provision_k8s
+copy_k8s_config
+