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
This commit is contained in:
parent
ed2fd510a5
commit
fe0fc835cd
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ playbooks/testing.yml
|
||||
*.idea
|
||||
**/__pycache__/
|
||||
.venv/
|
||||
.ansible/
|
||||
|
8
Makefile
Normal file
8
Makefile
Normal 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
|
18
dynamically-link-local-collections.bash
Executable file
18
dynamically-link-local-collections.bash
Executable 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!"
|
Reference in New Issue
Block a user