No description
  • Python 76.5%
  • Jinja 23%
  • Shell 0.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
oliver.maklott 60f9fd4908
All checks were successful
ci / build (push) Successful in 1s
ci / units (push) Successful in 3s
ci / lint (push) Successful in 11s
ci / sanity (push) Successful in 12s
ci / molecule (push) Successful in 4m38s
release / release (push) Successful in 2s
Release 0.9.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PVUe4g65L7UnUVqHmQp7kG
2026-11-30 08:52:33 +00:00
.forgejo/workflows belowtoxic.openbao 0.3.0: openbao_server role 2026-11-26 23:55:03 +00:00
changelogs Release 0.9.0 2026-11-30 08:52:33 +00:00
extensions/molecule QC: an audit device; secret files not on sudo's log 2026-11-30 07:31:21 +00:00
meta belowtoxic.openbao 0.1.0: OpenBao configuration and inventory 2026-11-22 20:20:34 +00:00
plugins belowtoxic.openbao 0.7.0: the WireGuard registry per network 2026-11-29 01:32:29 +00:00
roles QC: an audit device; secret files not on sudo's log 2026-11-30 07:31:21 +00:00
tests/unit belowtoxic.openbao 0.7.0: the WireGuard registry per network 2026-11-29 01:32:29 +00:00
.ansible-lint belowtoxic.openbao 0.1.0: OpenBao configuration and inventory 2026-11-22 20:20:34 +00:00
.copier-answers.yml belowtoxic.openbao 0.1.0: OpenBao configuration and inventory 2026-11-22 20:20:34 +00:00
.gitignore belowtoxic.openbao 0.1.0: OpenBao configuration and inventory 2026-11-22 20:20:34 +00:00
.gitleaks.toml belowtoxic.openbao 0.1.0: OpenBao configuration and inventory 2026-11-22 20:20:34 +00:00
.pre-commit-config.yaml belowtoxic.openbao 0.1.0: OpenBao configuration and inventory 2026-11-22 20:20:34 +00:00
.yamllint belowtoxic.openbao 0.1.0: OpenBao configuration and inventory 2026-11-22 20:20:34 +00:00
CHANGELOG.md Release 0.9.0 2026-11-30 08:52:33 +00:00
CONTRIBUTING.md belowtoxic.openbao 0.1.0: OpenBao configuration and inventory 2026-11-22 20:20:34 +00:00
galaxy.yml Release 0.9.0 2026-11-30 08:52:33 +00:00
LICENSE belowtoxic.openbao 0.1.0: OpenBao configuration and inventory 2026-11-22 20:20:34 +00:00
README.md belowtoxic.openbao 0.3.0: openbao_server role 2026-11-26 23:55:03 +00:00
ruff.toml belowtoxic.openbao 0.1.0: OpenBao configuration and inventory 2026-11-22 20:20:34 +00:00
SECURITY.md belowtoxic.openbao 0.1.0: OpenBao configuration and inventory 2026-11-22 20:20:34 +00:00

belowtoxic.openbao

OpenBao as the source of truth for the belowtoxic infrastructure code:

  • configuration as code for OpenBao itself - KV mounts, auth methods, SSH certificate authorities, ACL policies, AppRoles;
  • an inventory plugin that turns non-secret intent documents stored in OpenBao (hosts, guests, global settings) into Ansible inventory;
  • a small, idempotent API module used by both.

Works with OpenBao and HashiCorp Vault (same API). No Python dependencies beyond ansible-core.

Part of belowtoxic-ansible.

Content

Name Type Purpose
belowtoxic.openbao.openbao_server role OpenBao in a container: raft on a volume, VPN-only listeners, ACME DNS-01 certificate, encrypted snapshots (README)
belowtoxic.openbao.openbao_config role Mounts, auth, SSH CAs, policies, AppRoles
belowtoxic.openbao.infra inventory Hosts and guests from infra/hosts/*, infra/guests/*, infra/global
belowtoxic.openbao.bao_api module Read-compare-write any OpenBao API resource (check and diff mode)

Reading secrets at use time is left to community.hashi_vault (vault_kv2_get with no_log: true).

Data layout

infra/                  KV v2, non-secret intent (inventory plugin reads it)
  global                domain, admin CIDRs, ...
  hosts/<host>          role, storage, NAT network, IPv6 delivery mode, ...
  guests/<guest>        type (vm|microvm), host, os, sizing, nics[], expose[]
secrets/                KV v2, secrets - read at use time, never inventory
ssh-host/               SSH engine: signs host keys (role "hosts")
ssh-client/             SSH engine: short-lived user certificates (role "ansible")
auth/approle/           AppRoles "ansible-ci" (automation), "openbao-snapshot" (snapshot timer)

Policies created by the role:

Policy For Grants
ansible-ci CI and automation (AppRole) read infra/, read secrets/, sign SSH user and host certificates, wrap tokens
infra-editor humans editing intent create/update infra/
ansible-admin interactive runs of openbao_config everything the role manages - no seal, audit or raw access
openbao-snapshot the snapshot timer of openbao_server (AppRole, 127.0.0.1 only) read sys/storage/raft/snapshot

Quickstart

Configure OpenBao (admin token, interactively):

# playbooks/openbao_config.yml
- name: OpenBao configuration
  hosts: localhost
  connection: local
  gather_facts: false
  vars:
    ansible_python_interpreter: "{{ ansible_playbook_python }}"
  roles:
    - role: belowtoxic.openbao.openbao_config
export VAULT_ADDR=https://bao.example.com:8200
bao login -method=oidc         # or userpass; the token lands in ~/.vault-token
ansible-playbook -i localhost, playbooks/openbao_config.yml --diff --check

-i localhost, keeps a site inventory that reads OpenBao (which is not set up yet) out of the first run. It also makes localhost an ordinary host whose Python Ansible would probe on PATH (a pyenv shim, a system Python); ansible_python_interpreter keeps the modules on Ansible's own Python. Host certificate domains, delegated tokens for VMs and agents: see the role README.

The role never creates AppRole secret IDs and never rotates CA keys. Issue a secret ID for CI explicitly and store it as a Forgejo secret:

bao read -field=role_id auth/approle/role/ansible-ci/role-id
bao write -f -field=secret_id auth/approle/role/ansible-ci/secret-id

Inventory source (file name must end in infra.yml or openbao.yml):

# inventory/20-infra.yml
plugin: belowtoxic.openbao.infra
keyed_groups:
  - key: infra_host.role | default(omit)
    prefix: role

The plugin authenticates with BAO_TOKEN/VAULT_TOKEN, else AppRole (BAO_ROLE_ID + BAO_SECRET_ID), else the token helper files ~/.bao-token/~/.vault-token. It creates the groups infra_hosts, infra_guests, infra_guests_<type> and infra_guests_on_<host>, and the variables infra_host, infra_guest and infra_global. Values are marked unsafe, so data from OpenBao is never evaluated as a template.

Security notes

  • Secrets never enter the inventory; keep them under secrets/.
  • bao_api marks token as no_log; use no_log: true on tasks whose data contains secrets and list such keys in ignore_keys.
  • Use validate_certs: true (default) and ca_cert for a private CA.

Development

eval "$(../toolchain/bin/bt-ci-setup)"
bt-ci lint && bt-ci sanity && bt-ci units
bt-ci molecule config    # starts a throwaway `bao server -dev` on 127.0.0.1

License

GPL-3.0-or-later, see LICENSE.