c25c30bb0b
The validations now have a custom Ansible formatter that shows a better report on the validation run, what failed and why, etc. This makes it available to our Mistral workflows. Change-Id: Iebe26e3e2922dafc7f93837c4315cebf14563f6d Depends-On: I9730f2dd04868c5de46ae90bd545865d17aec530 Closes-Bug: #1625526
58 lines
1.6 KiB
Bash
Executable File
58 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
set -o pipefail
|
|
|
|
VALIDATION_FILE=$1
|
|
IDENTITY_FILE=$2
|
|
PLAN_NAME=$3
|
|
|
|
if [[ -z "$VALIDATION_FILE" ]]; then
|
|
echo "Missing required validation file"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -r "$VALIDATION_FILE" ]]; then
|
|
echo "Can not find validation at $VALIDATION_FILE"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -z "$IDENTITY_FILE" ]]; then
|
|
echo "Missing required identity file"
|
|
exit 1
|
|
fi
|
|
|
|
# Make sure ssh is not asking interactively for hosts it can't check the key
|
|
# authenticity
|
|
export ANSIBLE_HOST_KEY_CHECKING=False
|
|
# Disable retry files until we find a good use and location for them
|
|
export ANSIBLE_RETRY_FILES_ENABLED=False
|
|
# Add `-E` to the sudo flags to preserve the shell environment. The `-H -S -n`
|
|
# options are Ansible's default values.
|
|
export ANSIBLE_SUDO_FLAGS="-H -S -n -E"
|
|
|
|
export ANSIBLE_PRIVATE_KEY_FILE=$IDENTITY_FILE
|
|
|
|
export ANSIBLE_INVENTORY=$(which tripleo-ansible-inventory)
|
|
|
|
# Use the custom validation-specific formatter
|
|
export ANSIBLE_STDOUT_CALLBACK=validation_output
|
|
|
|
# Environment variable is the easiest way to pass variables to an Ansible
|
|
# dynamic inventory script
|
|
export TRIPLEO_PLAN_NAME=${PLAN_NAME}
|
|
|
|
# NOTE(shadower): set up token-based environment for the openstack
|
|
# client when the password doesn't exist. This happens when called
|
|
# from mistral:
|
|
if [ -z "${OS_PASSWORD:-}" ]; then
|
|
# The auth type must be explicitly set to token
|
|
export OS_AUTH_TYPE=token
|
|
# The openstack client expects the token as OS_TOKEN
|
|
export OS_TOKEN=$OS_AUTH_TOKEN
|
|
# TODO(shadower): I could not get the token auth working with v3:
|
|
export OS_AUTH_URL=${OS_AUTH_URL/%v3/v2.0}
|
|
fi
|
|
|
|
ansible-playbook $VALIDATION_FILE
|