Browse Source

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
Logan V 7 months ago
parent
commit
70f44bd55f
3 changed files with 36 additions and 0 deletions
  1. 1
    0
      .zuul.d/playbooks-deploy/run.yml
  2. 29
    0
      scripts/functions.sh
  3. 6
    0
      scripts/run_deploy.sh

+ 1
- 0
.zuul.d/playbooks-deploy/run.yml View File

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

+ 29
- 0
scripts/functions.sh View File

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

+ 6
- 0
scripts/run_deploy.sh View File

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

Loading…
Cancel
Save