List icon
Script icon
Docker icon
ForEach icon
Create icon
Create icon
Schedule icon

NetBox Drift Reconciliation with GitHub Audit Trail

Reconcile a live network scan against NetBox with Kestra. Auto-register missing devices and open a GitHub issue documenting every drift on a schedule.

Categories
Infrastructure

Network documentation rots the moment a switch is racked without a NetBox entry. This NetBox drift reconciliation blueprint detects that gap automatically: it reads the devices NetBox records for a site, compares them to a live discovery scan, registers any devices that exist on the network but are missing from your source of truth, and opens a GitHub issue summarizing the reconciliation so the team keeps a permanent audit trail. Run it on a schedule and undocumented infrastructure changes surface before they cause an outage or a failed audit.

How it works

  1. list_netbox_devices (io.kestra.plugin.ee.netbox.device.List) fetches the device names NetBox currently records for the requested site slug using fetchType: FETCH.
  2. scan_and_diff (io.kestra.plugin.scripts.python.Script, run on a Docker task runner) reads those devices, compares them to a discovery source, and emits the missing devices plus a drift_count via Kestra.outputs.
  3. register_missing_devices (io.kestra.plugin.core.flow.ForEach) loops over each missing device and calls create_device (io.kestra.plugin.ee.netbox.device.Create) to register it in NetBox with status: active.
  4. open_drift_issue (io.kestra.plugin.github.issues.Create) opens a GitHub issue in github_repository, titled with the site and labeled netbox-drift, documenting how many devices were reconciled.

What you get

  • NetBox kept in sync with what is actually on the network.
  • Automatic registration of undocumented devices, no manual data entry.
  • A GitHub issue per run as a dated, searchable audit trail.
  • A daily schedule trigger (disabled by default) ready to enable.

Who it's for

  • Network engineers and NetOps teams maintaining NetBox as a source of truth.
  • Infrastructure and platform teams enforcing inventory accuracy.
  • Compliance owners who need an auditable record of network changes.

Why orchestrate this with Kestra

NetBox is a system of record, not a scheduler. It will not poll your network, reconcile drift, retry a flaky API call, or notify your team. Kestra adds the event triggers, the Schedule trigger, automatic retries, and execution lineage that turn a one-off script into a dependable control loop. The whole pipeline is declarative YAML, version controlled, and every run is observable end to end.

Prerequisites

Secrets

  • NETBOX_URL: base URL of your NetBox instance.
  • NETBOX_API_TOKEN: NetBox API token with device read and write access.
  • GITHUB_TOKEN: GitHub token allowed to open issues in the target repository.

You also need NetBox device type and role slugs that match what your scan reports.

Quick start

  1. Set NETBOX_URL, NETBOX_API_TOKEN, and GITHUB_TOKEN as secrets in your Kestra namespace.
  2. Replace the discovery stub in scan_and_diff with your real scan source (SNMP sweep, scanner export, CMDB feed).
  3. Execute the flow with a site slug and a github_repository.
  4. Enable the daily_reconciliation Schedule trigger to run it continuously.

How to extend

  • Swap the Python stub for an SNMP sweep, Nmap export, or a vendor controller API.
  • Register devices with status: planned to require human confirmation before activation.
  • Add a Slack or email notification alongside the GitHub issue.
  • Reconcile multiple sites by looping over a list of site slugs.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.