Compare commits

...

3 Commits

5 changed files with 25 additions and 14 deletions

2
.env Normal file
View File

@ -0,0 +1,2 @@
ANSIBLE_COLLECTIONS_PATH=$(pwd)/.ansible
ANSIBLE_INVENTORY=$(pwd)/inventory.yaml

View File

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

View File

@ -2,11 +2,15 @@
Ansible configs for the Skylab Homelab Ansible configs for the Skylab Homelab
Main entrypoint is through the `ansible` script in this repository. The script sets up ## Local workstation setup:
basic environment variables to avoid conflicts with other environments and sets the
inventory.
Bootstrap checklist: ```bash
make dev
poetry shell
source .env
```
## Boostraping remote system for management:
1. Install a supported operating system: [Rocky Linux](https://rockylinux.org) 1. Install a supported operating system: [Rocky Linux](https://rockylinux.org)
2. During installation create a user named `ansible` with any password 2. During installation create a user named `ansible` with any password

View File

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

View File

@ -15,4 +15,14 @@ for collection_path in "$PWD"/"$ANSIBLE_NAMESPACE"/*; do
fi fi
done 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