skylab
/
skylab-ansible
Archived
2
0
Fork 0

Add environment check to collection linking script

This commit is contained in:
Ethan Paul 2021-12-23 23:23:03 -05:00
parent 9cd0cfcb4f
commit 7bb00a3586
No known key found for this signature in database
GPG Key ID: 6A337337DF6B5B1A
2 changed files with 15 additions and 5 deletions

View File

@ -2,7 +2,7 @@ clean:
rm --recursive --force .ansible/
dev:
poetry install --remove-untracked
poetry run pre-commit install
poetry run ansible-galaxy collection install --requirements-file ./requirements.yaml --collections-path ./.ansible
./dynamically-link-local-collections.bash
@poetry install --remove-untracked
@poetry run pre-commit install
@poetry run ansible-galaxy collection install --requirements-file ./requirements.yaml --collections-path ./.ansible
@bash ./link-local-collections.sh

View File

@ -15,4 +15,14 @@ for collection_path in "$PWD"/"$ANSIBLE_NAMESPACE"/*; do
fi
done
echo "Done!"
echo "Finished linking local collections"
LOCAL_COLLECTION_PATH=$(dirname "$ANSIBLE_COLLECTION_DIR")
if [ -z ${ANSIBLE_COLLECTIONS_PATH+x} ]; then
echo "WARNING: Environment variable ANSIBLE_COLLECTIONS_PATH is not set, collections will not be callable"
echo " HINT: export ANSIBLE_COLLECTIONS_PATH=$LOCAL_COLLECTION_PATH"
elif [[ ${ANSIBLE_COLLECTIONS_PATH} != *"$LOCAL_COLLECTION_PATH"* ]]; then
echo "WARNING: Environment variable ANSIBLE_COLLECTIONS_PATH does not include local collection directory"
echo " HINT: export ANSIBLE_COLLECTIONS_PATH=\$ANSIBLE_COLLECTIONS_PATH:$LOCAL_COLLECTION_PATH"
fi