From bda91649e840033918fe250d91355466fae70bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Mon, 8 Feb 2016 18:05:58 +0900 Subject: [PATCH] Increase ansible verbosity during gate deploy The gate currently doesn't provide any context when ansible fails. This commit adds a new --verbose option to `kolla-ansible` that is passed to `ansible-playbook`, and sets the default to -vvv for `kolla-ansible deploy` in the gate. TrivialFix Change-Id: If248a4186b140e1ec0d2e787c27481cec7e81eec --- tools/deploy_aio.sh | 2 +- tools/kolla-ansible | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/deploy_aio.sh b/tools/deploy_aio.sh index 63b841fd6e..7faad99b46 100755 --- a/tools/deploy_aio.sh +++ b/tools/deploy_aio.sh @@ -34,7 +34,7 @@ EOF ip l a fake_interface type dummy # Actually do the deployment -tools/kolla-ansible deploy +tools/kolla-ansible -vvv deploy check_failure diff --git a/tools/kolla-ansible b/tools/kolla-ansible index fc17f1495d..cf9d1038d2 100755 --- a/tools/kolla-ansible +++ b/tools/kolla-ansible @@ -33,6 +33,7 @@ Options: --keyfile, -k Specify path to ansible vault keyfile --help, -h Show this usage information --tags, -t Only run plays and tasks tagged with these values + --verbose, -v Increase verbosity of ansible-playbook Commands: prechecks Do pre-deployment checks for hosts @@ -43,8 +44,8 @@ EOF } -SHORT_OPTS="hi:p:t:k:" -LONG_OPTS="help,inventory:,playbook:,tags:,keyfile:" +SHORT_OPTS="hi:p:t:k:v" +LONG_OPTS="help,inventory:,playbook:,tags:,keyfile:,verbose" ARGS=$(getopt -o "${SHORT_OPTS}" -l "${LONG_OPTS}" --name "$0" -- "$@") || { usage >&2; exit 2; } eval set -- "$ARGS" @@ -54,6 +55,7 @@ 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= while [ "$#" -gt 0 ]; do case "$1" in @@ -67,11 +69,17 @@ while [ "$#" -gt 0 ]; do PLAYBOOK="$2" shift 2 ;; + (--tags|-t) EXTRA_OPTS="$EXTRA_OPTS --tags $2" shift 2 ;; + (--verbose|-v) + VERBOSITY="$VERBOSITY --verbose" + shift 1 + ;; + (--keyfile|-k) VAULT_PASS_FILE="$2" EXTRA_OPTS="$EXTRA_OPTS --vault-password-file=$VAULT_PASS_FILE" @@ -124,5 +132,5 @@ case "$1" in ;; esac -CMD="ansible-playbook -i $INVENTORY $EXTRA_OPTS $PLAYBOOK" +CMD="ansible-playbook -i $INVENTORY $EXTRA_OPTS $PLAYBOOK $VERBOSITY" process_cmd