alembic
distills data between dcim/ipam systems, co-evolved with ai
alembic is a data-model-first converger + loader for dcim/ipam systems. it defines a canonical, vendor-neutral ir (intermediate representation) and an engine that validates, plans, and applies changes to a backend. it supports multiple backend adapters, including NetBox, Nautobot, Infrahub, generic REST APIs, and PeeringDB (read-only).
concepts
- ir objects: typed objects with stable
uid(uuid), atype, a humankey, andattrs. - relationships: references are always by
uid, never backend ids. - plan: a deterministic list of operations (create/update/delete) generated by diffing desired ir against observed backend state.
- state store: maps
uidto backend ids (integers or uuids) per type to keep renames stable; defaults to.alembic/state.jsonand can use postgres.
quickstart
-
create a brew file (yaml) describing your desired state. see
examples/brew.yaml. -
validate:
- plan (writes a json plan file):
# netbox
NETBOX_URL=https://netbox.example.com NETBOX_TOKEN=... \
# nautobot
NAUTOBOT_URL=https://nautobot.example.com NAUTOBOT_TOKEN=... \
# infrahub
INFRAHUB_URL=https://infrahub.example.com INFRAHUB_TOKEN=... \
- apply:
NETBOX_URL=https://netbox.example.com NETBOX_TOKEN=... \
- raw + retort:
- optional: generate a django app from a brew inventory:
adapter coverage
netbox and nautobot adapters are schema-driven and resolve types dynamically via their content type/object type APIs.
the infrahub adapter uses graphql and can optionally provision missing types/fields by generating
an infrahub schema file and applying it during apply.
- any
typewith a REST endpoint can be observed and applied attrsare passed through using backend field namesref/list_reffields are resolved via state mappings during apply- custom fields and tags are mapped by adapters when supported by the backend
- netbox custom object types can be provisioned on apply when the netbox custom objects plugin is installed
relationships are validated strictly by schema and uid references.
workspace layout
crates/alembic-core: ir types, serde, validation primitivescrates/alembic-engine: loader, graph validation, planning, state storecrates/alembic-adapter-registry: adapter config + registry for the clicrates/alembic-adapter-netbox: netbox adaptercrates/alembic-adapter-nautobot: nautobot adaptercrates/alembic-adapter-infrahub: infrahub graphql adaptercrates/alembic-adapter-generic: generic rest adaptercrates/alembic-adapter-peeringdb: peeringdb adaptercrates/alembic-cli: cli binary
notes
- input files never contain backend ids.
- plans are deterministic and stable-sorted.
- deletes are gated behind
--allow-delete.
documentation
docs/index.mddocs/ir.mddocs/brew.mddocs/retort.mddocs/engine.mddocs/plan.mddocs/state.mddocs/cli.mddocs/cast.mddocs/netbox.mddocs/nautobot.mddocs/infrahub.mddocs/development.md