Implement a callback plugin for human readable ansible logs

This implements a callback plugin to make the ansible logs easier
to read. This is especially pertinent for the output of tasks
like shell commands and apt package actions.

It also disables the use of the verbose parameter for Ansible, as
this plugin outputs stdout/stderr anyway.

Change-Id: I56886ba1d7f99b861f625c68078583e82dae2988
This commit is contained in:
Jesse Pretorius
2015-12-08 14:49:39 +00:00
parent 892c7fe46c
commit 775d256a4e

View File

@@ -17,7 +17,6 @@
set -e -u -x
## Variables -----------------------------------------------------------------
export ANSIBLE_PARAMETERS=${ANSIBLE_PARAMETERS:-"-v"}
export MAX_RETRIES=${MAX_RETRIES:-"2"}
# tempest and testr options, default is to run tempest in serial
export RUN_TEMPEST_OPTS=${RUN_TEMPEST_OPTS:-'--serial'}
@@ -101,7 +100,10 @@ pushd $(dirname ${0})/../playbooks
mkdir -p /openstack/log/ansible-logging
sed -i '/\[defaults\]/a log_path = /openstack/log/ansible-logging/ansible.log' ansible.cfg
# Enable detailed task profiling
# This plugin makes the output easier to read
wget -O plugins/callbacks/human_log.py https://gist.githubusercontent.com/cliffano/9868180/raw/f360f306b3c6d689734a6aa8773a00edf16a0054/human_log.py
# Enable callback plugins
sed -i '/\[defaults\]/a callback_plugins = plugins/callbacks' ansible.cfg
popd