summaryrefslogtreecommitdiffstats
path: root/tools/keystone/run.sh
diff options
context:
space:
mode:
authorDimitri Mazmanov <dimitri.mazmanov@ericsson.com>2016-11-28 13:25:54 +0100
committerDimitri Mazmanov <dimitri.mazmanov@ericsson.com>2017-01-23 11:13:10 +0100
commite7fe8818ece870b88556f7bad78b589b26d19151 (patch)
tree874f74b7b7d59b3a432fdebb9041a78ad346af26 /tools/keystone/run.sh
parent60dca59ac451300fae214776e82a068b2e8607da (diff)
Common auth configuration for Mulsite deployment
This set of scripts is used to configure centralized Keystone across multiple regions. Each script is executed during a certain stage of the automated multisite deployment setup via Jenkins [1]. region.sh - registers new endpoints in Keystone tagging them with RegionTwo. fetchpass.sh - reads service passwords in the master region and stores them in an encrypted file. endpoint.sh - reads the public_url, private_url and admin_url from RegionTwo and stores it in a file to be used during region registration phase. run.sh - is a generic proxy runner which triggers execution of any runnable on a target node (compute|controller). writepass.sh - updates service password entries in the configuration files for RegionTwo. [1] https://wiki.opnfv.org/display/multisite/Multisite+Deployment+Environment Change-Id: If2c91600237003a13cc0dc822924ab8d27ce202c Signed-off-by: Dimitri Mazmanov <dimitri.mazmanov@ericsson.com>
Diffstat (limited to 'tools/keystone/run.sh')
-rwxr-xr-xtools/keystone/run.sh92
1 files changed, 92 insertions, 0 deletions
diff --git a/tools/keystone/run.sh b/tools/keystone/run.sh
new file mode 100755
index 0000000..6fc02ca
--- /dev/null
+++ b/tools/keystone/run.sh
@@ -0,0 +1,92 @@
+#!/bin/bash
+#
+# Author: Dimitri Mazmanov (dimitri.mazmanov@ericsson.com)
+#
+# 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
+set -o nounset
+set -o pipefail
+
+
+# This script proxies execution of other scripts through fuel node
+# onto the destination node.
+# Usage: run.sh (controller|compute) <runnable_script.sh>
+
+INSTALLER_IP=10.20.0.2
+
+usage() {
+ echo "usage: $0 -a <installer_ip> -t (controller|compute) -r <runnable_script.sh> -d <data_file>" >&2
+}
+
+error () {
+ logger -s -t "deploy.error" "$*"
+ exit 1
+}
+
+if [ $# -eq 0 ]; then
+ usage
+ exit 2
+fi
+
+while [[ $# -gt 0 ]]; do
+case $1 in
+ -i|--installer)
+ installer_ip="$2"
+ shift # past argument
+ ;;
+ -t|--target)
+ target="$2"
+ shift # past argument
+ ;;
+ -r|--runnable)
+ runnable="$2"
+ shift # past argument
+ ;;
+ -d|--data)
+ data="$2"
+ shift # past argument
+ ;;
+ *)
+ echo "Non-option argument: '-${OPTARG}'" >&2
+ usage
+ exit 2
+ ;;
+esac
+shift # past argument or value
+
+installer_ip=${installer_ip:-$INSTALLER_IP}
+data=${data:-""}
+
+ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
+
+function run_on_target() {
+ # Copy the script to the target
+ sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
+ "ssh $ssh_options $1 \"cd /root/ && cat > ${runnable}\"" < ${runnable} &> /dev/null
+ if [ -n "${data}" ]; then
+ # Copy any accompanying data along with the script
+ sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
+ "ssh $ssh_options $1 \"cd /root/ && cat > ${data}\"" < ${data} &> /dev/null
+ fi
+ # Set the rights and execute
+ sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
+ "ssh $ssh_options $1 \"cd /root/ && chmod +x ${runnable}\"" &> /dev/null
+ sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
+ "ssh $ssh_options $1 \"cd /root/ && nohup /root/${runnable} > install.log 2> /dev/null\"" &> /dev/null
+ # Output here
+ sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
+ "ssh $ssh_options $1 \"cd /root/ && cat install.log\""
+}
+
+target_info=$(sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
+fuel node list| grep ${target} | grep "True\| 1" | awk -F\| "{print \$5}" | \
+sed 's/ //g') &> /dev/null
+
+for machine in ${target_info} ; do
+ run_on_target $machine
+done