Merge "Create symlink to ansible collections on install"

This commit is contained in:
Zuul 2020-07-24 09:50:00 +00:00 committed by Gerrit Code Review
commit 32cea7418d
3 changed files with 20 additions and 1 deletions

View File

@ -332,7 +332,9 @@ ansible.cfg) or you can specify the location setting
.. note::
If you are using a virtual environment ANSIBLE_COLLECTIONS_PATHS is
automatically set.
automatically set. After Ansible Collections are installed,
a symbolic link to to the installation is created in the bifrost playbook
directory.
The ``env-setup.sh`` script automatically invokes ``install-deps.sh`` and
creates a virtual environment for you:

View File

@ -0,0 +1,11 @@
---
features:
- |
Added creation of a symbolic link from $VENV/collections directory which
contains ansible collections to the playbooks subdirectory of bifrost.
This is done in the env-setup.sh script.
fixes:
- |
The addition of the symbolic link makes bifrost playbooks independent of
the ANSIBLE_COLLECTIONS_PATHS environment variable which wasn't reliably
set in some environments.

View File

@ -53,6 +53,12 @@ else
${ANSIBLE_GALAXY} collection install -r ${ANSIBLE_COLLECTION_REQ} -p ${BIFROST_COLLECTIONS_PATHS}
fi
# Symlink Collections to the playbook directory. This removes the need of setting
# ANSIBLE_COLLECTIONS_PATHS environment variable
if [ ! -e "$(dirname $0)/../playbooks/collections" ]; then
echo "Creating a symbolic link to ansible collections in bifrost playbook directory"
ln -s ${ANSIBLE_COLLECTIONS_PATHS} "$(dirname $0)/../playbooks/collections"
fi
echo
echo "To use bifrost, do"