Extracts variables from the local environment and converts them to Ansible variables.
Install: uv add [--dev] ans-env-loader
Then place an ans-env-vars.yaml and an env-loader.py into your Ansible playbooks root directory
as follows:
❯ tree
├── ansible.cfg
├── ans-env-vars.yaml
├── hosts.ini
├── playbook.yaml
└── vars_plugins
├── env-loader.py
❯ cat vars_plugins/env-loader.py
from ans_env_loader import VarsModule as VarsModule
❯ cat ans-env-vars.yaml
# Ansible var name is the same as the expected env var
- app_smtp_host
# Map Ansible var name to a different expected env var
- app_flask_secret: FLASK_SECRETProject structure and tooling mostly derives from the Coppy, see its documentation for context and additional instructions.
This project can be updated from the upstream repo, see Updating a Project.
From zero to hero (passing tests that is):
-
Ensure host dependencies are installed
-
Start docker service dependencies (if applicable):
docker compose up -d -
Sync project virtualenv w/ lock file:
uv sync -
Configure pre-commit:
pre-commit install -
Run tests:
nox
Versions are date based. A bump action exists to help manage versions:
# Show current version
mise bump --show
# Bump version based on date, tag, and push:
mise bump
# See other options
mise bump -- --help