From 9f7c3b630d0c1f3902063c03588c04dd84bd36ea Mon Sep 17 00:00:00 2001
From: SamYaple <sam@yaple.net>
Date: Fri, 5 Feb 2016 19:37:24 +0000
Subject: [PATCH] Fix non-root deploys

TrivialFix

Change-Id: Id0e7cf9e1c0c4259b8a50c39e95214103256517b
---
 tools/kolla-ansible | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/tools/kolla-ansible b/tools/kolla-ansible
index cf9d1038d2..0acb9d2d57 100755
--- a/tools/kolla-ansible
+++ b/tools/kolla-ansible
@@ -30,6 +30,7 @@ Usage: $0 COMMAND [options]
 Options:
     --inventory, -i <inventory_path> Specify path to ansible inventory file
     --playbook, -p <playbook_path>   Specify path to ansible playbook file
+    --configdir <config_path>        Specify path to directory with globals.yml
     --keyfile, -k <key_file>         Specify path to ansible vault keyfile
     --help, -h                       Show this usage information
     --tags, -t <tags>                Only run plays and tasks tagged with these values
@@ -45,7 +46,7 @@ EOF
 
 
 SHORT_OPTS="hi:p:t:k:v"
-LONG_OPTS="help,inventory:,playbook:,tags:,keyfile:,verbose"
+LONG_OPTS="help,inventory:,playbook:,tags:,keyfile:,verbose,configdir:"
 ARGS=$(getopt -o "${SHORT_OPTS}" -l "${LONG_OPTS}" --name "$0" -- "$@") || { usage >&2; exit 2; }
 
 eval set -- "$ARGS"
@@ -54,8 +55,9 @@ find_base_dir
 
 INVENTORY="${BASEDIR}/ansible/inventory/all-in-one"
 PLAYBOOK="${BASEDIR}/ansible/site.yml"
-EXTRA_OPTS="-e @/etc/kolla/globals.yml -e @/etc/kolla/passwords.yml"
 VERBOSITY=
+EXTRA_OPTS=
+CONFIG_DIR="/etc/kolla"
 
 while [ "$#" -gt 0 ]; do
     case "$1" in
@@ -80,6 +82,11 @@ while [ "$#" -gt 0 ]; do
             shift 1
             ;;
 
+    (--configdir)
+            CONFIG_DIR="$2"
+            shift 2
+            ;;
+
     (--keyfile|-k)
             VAULT_PASS_FILE="$2"
             EXTRA_OPTS="$EXTRA_OPTS --vault-password-file=$VAULT_PASS_FILE"
@@ -132,5 +139,6 @@ case "$1" in
         ;;
 esac
 
-CMD="ansible-playbook -i $INVENTORY $EXTRA_OPTS $PLAYBOOK $VERBOSITY"
+CONFIG_OPTS="-e @${CONFIG_DIR}/globals.yml -e @${CONFIG_DIR}/passwords.yml"
+CMD="ansible-playbook -i $INVENTORY $CONFIG_OPTS $EXTRA_OPTS $PLAYBOOK $VERBOSITY"
 process_cmd