Compare commits
3 Commits
9cd0cfcb4f
...
924341a276
Author | SHA1 | Date | |
---|---|---|---|
924341a276 | |||
b36bbec72a | |||
7bb00a3586 |
2
.env
Normal file
2
.env
Normal file
@ -0,0 +1,2 @@
|
||||
ANSIBLE_COLLECTIONS_PATH=$(pwd)/.ansible
|
||||
ANSIBLE_INVENTORY=$(pwd)/inventory.yaml
|
8
Makefile
8
Makefile
@ -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
|
||||
|
12
README.md
12
README.md
@ -2,11 +2,15 @@
|
||||
|
||||
Ansible configs for the Skylab Homelab
|
||||
|
||||
Main entrypoint is through the `ansible` script in this repository. The script sets up
|
||||
basic environment variables to avoid conflicts with other environments and sets the
|
||||
inventory.
|
||||
## Local workstation setup:
|
||||
|
||||
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)
|
||||
2. During installation create a user named `ansible` with any password
|
||||
|
5
ansible
5
ansible
@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ANSIBLE_COLLECTIONS_PATH=$(pwd)/.ansible \
|
||||
ANSIBLE_INVENTORY=$(pwd)/inventory.yaml \
|
||||
"ansible-$1" "${@:2}"
|
@ -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
|
Reference in New Issue
Block a user