Install ARA in-repo

Until https://review.openstack.org/#/c/602461/ has merged, install
ARA using scripts in this repo. This can be reverted once OSA supports
externally triggering the ARA installation.

Change-Id: I75e3ea94953315addf9a075889d26909127be7d3
This commit is contained in:
Logan V 2018-09-14 11:13:44 -06:00
parent 36a2e85ba5
commit 70f44bd55f
3 changed files with 36 additions and 0 deletions

View File

@ -6,6 +6,7 @@
environment:
SSH_AUTH_SOCK: "{{ ssh_agent_sock }}"
ANSIBLE_VAULT_PASSWORD_FILE: "{{ vault_key_path }}"
LSN_RUN_ARA: true
tasks:
- name: Run the deploy job
command: scripts/run_deploy.sh

29
scripts/functions.sh Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
LSN_RUN_ARA="${LSN_RUN_ARA:-false}"
# The vars used to prepare the Ansible runtime venv
PIP_COMMAND="/opt/ansible-runtime/bin/pip"
# NOTE(logan): Remove once https://review.openstack.org/#/c/602461/
# has merged.
function setup_ara {
# Install ARA and add it to the callback path provided by bootstrap-ansible.sh/openstack-ansible.rc
# This is added *here* instead of bootstrap-ansible so it's used for CI purposes only.
ARA_SRC_HOME="${HOME}/src/git.openstack.org/openstack/ara"
if [[ -d "${ARA_SRC_HOME}" ]]; then
# This installs from a git checkout
# PIP_COMMAND and PIP_OPTS are exported by the bootstrap-ansible script.
# PIP_OPTS contains the whole set of constraints that need to be applied.
${PIP_COMMAND} install --isolated ${PIP_OPTS} ${ARA_SRC_HOME} "${ANSIBLE_PACKAGE:-ansible}"
else
# This installs from pypi
# PIP_COMMAND and PIP_OPTS are exported by the bootstrap-ansible script.
# PIP_OPTS contains the whole set of constraints that need to be applied.
${PIP_COMMAND} install --isolated ${PIP_OPTS} ara "${ANSIBLE_PACKAGE:-ansible}"
fi
# Dynamically retrieve the location of the ARA callback so we are able to find
# it on both py2 and py3
ara_location=$(/opt/ansible-runtime/bin/python -c "import os,ara; print(os.path.dirname(ara.__file__))")
export ANSIBLE_CALLBACK_PLUGINS="/etc/ansible/roles/plugins/callback:${ara_location}/plugins/callbacks"
}

View File

@ -5,9 +5,15 @@ set -e
export SCRIPT_PATH=$(dirname $(readlink -f "$0"))
export PROJECT_PATH=$(dirname "$SCRIPT_PATH")
source "${SCRIPT_PATH}/functions.sh"
cp -R ${PROJECT_PATH}/openstack_deploy /etc
pushd ${PROJECT_PATH}/openstack-ansible
scripts/bootstrap-ansible.sh
if [ "$LSN_RUN_ARA" == true ]; then
setup_ara
fi
popd
pushd ${PROJECT_PATH}/openstack-ansible/playbooks