Compare commits

..

4 Commits

Author SHA1 Message Date
80c3565fa1
Update ansible script to use local collections path 2021-12-20 18:44:48 -05:00
fe0fc835cd
Add logic for building local ansible 'virtualenv'
Add makefile and targets for building local dev environment
Add script for linking dev collections into local collection dir
Add local collection dir to gitignore
2021-12-20 18:44:48 -05:00
ed2fd510a5
Rename requirements file to keep consistent file ext 2021-12-20 18:34:45 -05:00
b3e2d1c887
Add community.docker collection dependency 2021-12-20 18:12:51 -05:00
6 changed files with 31 additions and 5 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ playbooks/testing.yml
*.idea
**/__pycache__/
.venv/
.ansible/

8
Makefile Normal file
View File

@ -0,0 +1,8 @@
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

View File

@ -1,7 +1,5 @@
#!/usr/bin/env bash
ANSIBLE_LIBRARY='' \
ANSIBLE_FILTER_PLUGINS='' \
ANSIBLE_CONFIG='' \
ANSIBLE_COLLECTIONS_PATH=$(pwd)/.ansible \
ANSIBLE_INVENTORY=$(pwd)/inventory.yaml \
"ansible-$1" ${@:2}
"ansible-$1" "${@:2}"

View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
PWD=$(pwd)
ANSIBLE_NAMESPACE="skylab"
ANSIBLE_COLLECTION_DIR="$PWD/.ansible/ansible_collections"
mkdir --parents "$ANSIBLE_COLLECTION_DIR/$ANSIBLE_NAMESPACE"
for collection_path in "$PWD"/"$ANSIBLE_NAMESPACE"/*; do
collection=$(basename "$collection_path")
if [[ ! -L "$ANSIBLE_COLLECTION_DIR/$ANSIBLE_NAMESPACE/$collection" ]]; then
echo "Linking $ANSIBLE_NAMESPACE.$collection into $ANSIBLE_COLLECTION_DIR"
rm --recursive --force "${ANSIBLE_COLLECTION_DIR:?}/$ANSIBLE_NAMESPACE/$collection"
ln --symbolic "$PWD/$ANSIBLE_NAMESPACE/$collection" "$ANSIBLE_COLLECTION_DIR/$ANSIBLE_NAMESPACE/$collection"
fi
done
echo "Done!"

View File

@ -16,4 +16,5 @@ build_ignore: []
# collection label 'namespace.name'. The value is a version range
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
# range specifiers can be set and are separated by ','
dependencies: {}
dependencies:
community.docker: ">=2.0.2,<3.0.0"