aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-07-31 23:03:49 +0000
committerGerrit Code Review <review@openstack.org>2015-07-31 23:03:49 +0000
commit72f35b14d2309fd47ae1aff3d9a828fda6cc178f (patch)
treec4c0d0f82e3043b0bb1277c93acbf129ab7b4e14 /tools
parenta4e29f6608a6f487944b1555a18657952d28ec3f (diff)
parent76cdc9fe497ee80773c632b0e16df6ab680546e0 (diff)
downloadkolla-72f35b14d2309fd47ae1aff3d9a828fda6cc178f.tar.gz
kolla-72f35b14d2309fd47ae1aff3d9a828fda6cc178f.zip
Merge "Initial kolla-ansible command - deploy support only"
Diffstat (limited to 'tools')
-rwxr-xr-xtools/kolla-ansible81
1 files changed, 81 insertions, 0 deletions
diff --git a/tools/kolla-ansible b/tools/kolla-ansible
new file mode 100755
index 000000000..43341788d
--- /dev/null
+++ b/tools/kolla-ansible
@@ -0,0 +1,81 @@
+#!/bin/bash
+#
+# This script can be used to interact with kolla via ansible.
+
+# Move to top level directory
+REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')")
+cd "$(dirname "$REAL_PATH")/.."
+
+function process_cmd {
+ echo "$ACTION : $CMD"
+ $CMD
+ if [[ $? -ne 0 ]]; then
+ echo "Command failed $CMD"
+ exit 1
+ fi
+}
+
+function usage {
+ cat <<EOF
+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
+ --help, -h Show this usage information
+
+Commands:
+ deploy Deploy and start all kolla containers
+EOF
+}
+
+ARGS=$(getopt -o hi:p: -l help,inventory:,playbook: --name "$0" -- "$@") || { usage >&2; exit 2; }
+eval set -- "$ARGS"
+
+INVENTORY="ansible/inventory/all-in-one"
+PLAYBOOK="ansible/site.yml"
+
+while [ "$#" -gt 0 ]; do
+ case "$1" in
+
+ (--inventory|-i)
+ INVENTORY="$2"
+ shift 2
+ ;;
+
+ (--playbook|-p)
+ PLAYBOOK="$2"
+ shift 2
+ ;;
+
+ (--help|-h)
+ usage
+ shift
+ exit 0
+ ;;
+
+ (--)
+ shift
+ break
+ ;;
+
+ (*)
+ echo "error"
+ exit 3
+ ;;
+esac
+done
+
+case "$1" in
+
+(deploy)
+ ACTION="Deploying Playbook"
+ CMD="ansible-playbook -i $INVENTORY -e @/etc/kolla/defaults.yml -e @/etc/kolla/globals.yml -e @/etc/kolla/passwords.yml $PLAYBOOK"
+ ;;
+
+(*) usage
+ exit 0
+ ;;
+esac
+
+process_cmd