aboutsummaryrefslogtreecommitdiffstats
path: root/juju/adapter.sh
diff options
context:
space:
mode:
Diffstat (limited to 'juju/adapter.sh')
-rwxr-xr-xjuju/adapter.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/juju/adapter.sh b/juju/adapter.sh
new file mode 100755
index 0000000..f4c2d52
--- /dev/null
+++ b/juju/adapter.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+##############################################################################
+# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD 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
+##############################################################################
+function generate_compass_openrc()
+{
+ ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
+ MGMT_IP=192.168.200.2
+ exec_command="sshpass -p root ssh $ssh_options root@$MGMT_IP"
+
+ RUN_DIR=$(eval "$exec_command ls /var/ansible/run")
+
+ cmd="cat /var/ansible/run/$RUN_DIR/group_vars/all | grep -A 3 public_vip: | sed -n '2p' | sed -e 's/ ip: //g'"
+ PUBLIC_VIP=$(eval "$exec_command $cmd")
+
+ echo -e "export OS_PASSWORD=console \n\
+export OS_TENANT_NAME=admin \n\
+export OS_AUTH_URL=http://$PUBLIC_VIP:35357/v2.0 \n\
+export OS_USERNAME=admin \n\
+export OS_VOLUME_API_VERSION=2 \n\
+export OS_REGION_NAME=RegionOne " > $WORK_DIR/admin-openrc.sh
+
+}