- Python 49.2%
- Shell 34.9%
- Jinja 8.7%
- Dockerfile 7.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
An IPv4 address followed by a full stop was not found; without a denylist the scan now says so on a workstation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PVUe4g65L7UnUVqHmQp7kG |
||
| .forgejo/workflows | ||
| bin | ||
| config | ||
| docs | ||
| ee | ||
| requirements | ||
| src/belowtoxic_toolchain | ||
| template | ||
| tests | ||
| .dockerignore | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| .pre-commit-hooks.yaml | ||
| CHANGELOG.md | ||
| CONTRIBUTING.md | ||
| copier.yml | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
| SECURITY.md | ||
| tools.env | ||
toolchain
Shared tooling for every repository of the belowtoxic-ansible organisation:
one pinned toolchain for developers and CI, the leak checks that keep
infrastructure data out of these public repositories, shared lint
configuration, and the template every collection is generated from.
| Path | What |
|---|---|
bin/bt-ci-setup |
Builds the pinned toolchain on any Linux x86_64 host (developer laptop or CI runner) |
bin/bt-ci |
CI entry point: checkout, lint, sanity, units, molecule, build, release, leak-scan |
requirements/dev.in → dev.txt |
Python toolchain, locked with hashes (uv pip compile) |
tools.env |
Pinned external binaries (uv, butane, ignition-validate, bao, gitleaks, restic, hcloud-upload-image) with SHA-256 |
ee/ |
Optional container image with the same content (ee/Containerfile) |
config/ |
Shared ansible-lint, yamllint and gitleaks configuration |
src/belowtoxic_toolchain/public_ips.py |
check-public-ips: rejects public IP literals and denylisted strings |
copier.yml, template/ |
Collection template (copier copy / copier update) |
docs/ |
Conventions, leak prevention, runners |
Quick start
git clone https://git.belowtoxic.cloud/belowtoxic-ansible/toolchain.git
eval "$(toolchain/bin/bt-ci-setup)"
bt-ci-setup creates a content-addressed environment under
~/.cache/bt-ci/<hash> (override with BT_CI_HOME): a uv-managed Python,
the hash-locked Python packages (ansible-core, hvac, molecule, linters),
checksum-verified binaries (bao, butane, gitleaks, ...) and the
upstream collections from ee/requirements.yml. The first run takes about
a minute; later runs only print the environment. CI runs exactly the same
script.
It changes nothing in your shell by itself: it prints export lines,
and eval runs them. Run it plainly and it says so. Then check:
bt-ci doctor # in a repository: toolchain version, tools on PATH, hvac, collections, OpenBao login
To update: git pull in the toolchain checkout, then the same eval again
(a changed toolchain builds a new environment). bt-ci version shows which
one is active.
Virtualenvs and pyenv
The toolchain is a virtualenv - with a pinned Python and hash-checked
packages, identical to CI. You do not need another one, and the toolchain
does not install into yours. After the eval, its bin/ directories come
first in PATH, so an activated venv is shadowed (not used) until you
deactivate it or open a new shell.
Two setups put another environment back in front of the toolchain and make
ansible-playbook run on a Python without the pinned packages (symptom:
Failed to import the required Python library (hvac) naming another
Python):
- activating a venv after the
eval- run theevalagain, or don't activate the venv; - pyenv-virtualenv's automatic activation (
.python-versionnaming a virtualenv): its prompt hook re-activates it at every prompt - remove that.python-versionin these repositories, orpyenv deactivate.
bt-ci doctor names the culprit. If you really want to work in your own
venv: pip install --require-hashes -r toolchain/requirements/dev.txt,
ansible-galaxy collection install -r toolchain/ee/requirements.yml, and
install the binaries from tools.env yourself - CI will not test that
combination.
Collections
The toolchain's upstream collections live in its venv's site-packages,
which Ansible always searches last. Repositories install their own pins
to ./collections (ansible.cfg: collections_path = ./collections),
and those win. Leave ANSIBLE_COLLECTIONS_PATH unset: it overrides
ansible.cfg and hides ./collections (toolchain v0.3.x set it; the
eval of v0.4.0 unsets that old value).
New collection
copier copy --trust https://git.belowtoxic.cloud/belowtoxic-ansible/toolchain.git collection-foo
cd collection-foo && git init && pre-commit install
Pull later template changes (lint config, workflows, hooks) into an existing
collection with copier update --trust.
Updating pins
- Python: edit
requirements/dev.in, thenuv pip compile --universal --python-version 3.12 --generate-hashes -o requirements/dev.txt requirements/dev.in. - Binaries: change version and checksum in
tools.envand the matchingARGs inee/Containerfile. Verify upstream signatures where they exist (butane is signed with the Fedora key, OpenBao, gitleaks and hcloud-upload-image publish checksum files). hcloud-upload-image is workstation-only and has noARGin the Containerfile. - Collections:
ee/requirements.yml.
Release a new toolchain version (tag vX.Y.Z) and bump toolchain_ref in the
collections via copier update.
Tests
pytest -q && ruff check src tests && mypy --strict src
License
MIT, see LICENSE. The collection template ships GPL-3.0-or-later, as Ansible plugins link against ansible-core.