Logo von Netbox Automation Patterns

Netbox Automation Patterns

Organisation
netboxlabs
netbox-automation-patterns

End-to-end automation patterns with NetBox — event-driven workflows (event rules, webhooks), infrastructure-as-code (Ansible, Terraform), and GitOps integration. Use when building, advising on, or troubleshooting NetBox automation pipelines.

Übersicht

Herausgebernetboxlabs
Repositoryskills
Skill-Namenetbox-automation-patterns
Sterne
21
Forks
4
Mitgelieferte Dateien
4
LizenzApache-2.0
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • 4 mitgelieferte Dateien

    Skripte, Vorlagen und Referenzmaterial, die das Modell bei der Arbeit lesen kann. Die Dateien sind schreibgeschützt und werden niemals ausgeführt.

  • Open Source

    Von netboxlabs auf GitHub veröffentlicht. Prüfen Sie den Quellinhalt vor der Installation.

Installation

Installieren Sie den KI-Skill Netbox Automation Patterns in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner — liest SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/netboxlabs/skills/tree/main/skills/netbox-automation-patterns
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill anlegen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.
2

In einem anderen Agenten installieren

Jeder Agent, der das Agent-Skills-Format lesen kann, kann diesen Skill nutzen — kopieren Sie den Ordner in das Skill-Verzeichnis des jeweiligen Agenten.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/netboxlabs/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/netbox-automation-patterns .claude/skills/netbox-automation-patterns
Starten Sie Claude Code nach dem Kopieren neu, damit der neue Skill erkannt wird.

In TypingMind verwenden

Aktivieren Sie Netbox Automation Patterns in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt Netbox Automation Patterns automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist Netbox Automation Patterns nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Keys.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

NetBox Automation Patterns

Your knowledge of NetBox automation tools may be outdated. Ansible collection modules, Terraform provider resources, and event rule behavior change between releases. Prefer retrieval over pre-trained knowledge.

Retrieval Sources

SourceURL / MethodUse for
NetBox Ansible collectionhttps://github.com/netbox-community/ansible_modulesModule list, parameters, examples
Ansible docshttps://netboxlabs.com/docs/integrations/tool-integrations/netbox-ansible-collection/Integration guide
Terraform providerhttps://github.com/e-breuninger/terraform-provider-netboxResources, data sources
Event rules docshttps://netboxlabs.com/docs/netbox/features/event-rules/Webhook/script triggers
NetBox MCP serverIf configured — verify event rules, webhooks existValidate automation config

This skill covers how to integrate NetBox into automation workflows. It spans event-driven triggers, configuration management, infrastructure-as-code, and CI/CD pipelines. This is a cross-cutting skill — it ties together multiple open-source tools around NetBox as the source of truth.

Load this skill when:

  • Building webhook-driven automation triggered by NetBox changes
  • Configuring Ansible to use NetBox as dynamic inventory or state manager
  • Managing NetBox resources via Terraform
  • Designing GitOps pipelines with NetBox in the loop

Out of scope: NetBox core administration, plugin development, REST/GraphQL API basics (see netbox-api-integration).


Quick Reference: Which Tool for Which Pattern?

GoalToolPattern
React to changes in NetBoxEvent Rules + WebhooksPush notification to external system
React to changes internallyEvent Rules + Custom ScriptsRun logic inside NetBox
Define intended state in NetBoxAnsible modules (netbox.netbox)Declarative, idempotent
Use NetBox as Ansible inventorynb_inventory pluginDynamic inventory from NetBox data
Manage NetBox + cloud togetherTerraform (e-breuninger/netbox)IaC lifecycle, state tracking
Allocate next available IP/prefixTerraform available_* resourcesAuto-allocation from parent
NetBox → config generation → deployGitOps pipelineCI/CD with NetBox as source of truth

Event-Driven Automation

NetBox's event rule system (introduced in 3.7) is the foundation for reactive automation. An event rule matches object changes to actions.

Event Rule Essentials

  • Trigger scope: Object type(s) + event type(s) (created, updated, deleted, job started/completed/failed/errored)
  • Conditions: Optional JSON conditions to filter — e.g., only fire when status.value == "active". On 4.7+ conditions can also test the change itself: {"attr": "status", "op": "changed"} plus snapshots.prechange.<attr> / snapshots.postchange.<attr> paths, and a regex operator
  • Action types: webhook (external HTTP call), script (run a custom script), notification (notify users), plus plugin-registered action types on 4.7+
  • Processing: Asynchronous via Redis/RQ — the user request completes without waiting

Key Guidelines

  1. Always scope with conditions — Unscoped event rules fire on every matching change, creating noise and load. Use conditions to target specific statuses, roles, or tags. To fire only on a transition (status becomes active), use the 4.7 changed operator; on 4.5/4.6 compare snapshots.prechange/postchange in the body template instead. On 4.7+ a condition that references a non-existent attribute fails closed and logs — a rule that "stopped firing" after an edit is usually a typo.

  2. Events are async — Don't assume immediate execution. The event is queued to Redis/RQ and processed by a worker. Design receivers to handle delays.

  3. Choose the right action type:

    • External systems → webhook
    • Internal NetBox logic → custom script (see netbox-custom-scripts)
    • Human notification → notification group
  4. Test with the built-in receiver before production:

    bash
    python netbox/manage.py webhook_receiver  # Listens on port 9000
  5. Coalescing behavior — Multiple changes to the same object within one request are coalesced. Only the final state triggers the event. Delete events eagerly serialize data since the object won't exist later.

  6. Bound receiver time (4.7+) — Set a per-webhook timeout (or WEBHOOK_DEFAULT_TIMEOUT, default 60 s); it must stay below RQ_DEFAULT_TIMEOUT. Receivers should acknowledge fast and process asynchronously.

See references/event-rules-and-webhooks.md for payload format, HMAC signing, Jinja2 templating, and security considerations.


Ansible Integration

The netbox.netbox Ansible collection (GPLv3) provides modules, dynamic inventory, and lookup plugins.

Three Primary Use Cases

  1. State management — Use modules (netbox_device, netbox_ip_address, etc.) to ensure NetBox objects match desired state. All modules are idempotent with state: present/absent.

  2. Dynamic inventory — Use nb_inventory to generate Ansible inventory from NetBox. Group by device roles, sites, regions, tenants, tags, or platforms.

  3. Data lookup — Use nb_lookup to query NetBox data within playbooks.

Key Guidelines

  1. Set config_context: False in inventory unless you need it. On 4.5/4.6 this avoids an expensive per-device render server-side; on 4.7+ context is pre-rendered and cached, and the plugin sends ?exclude=config_context (ignored on every 4.7.x — 4.7.3's ?omit= optimisation doesn't reach it, as of netbox.netbox 3.23.1), so the option only trims hostvars.

  2. Use query_filters to limit inventory scope server-side rather than filtering client-side.

  3. Scope tokens properly — Read-only tokens for inventory/lookup, write tokens only for modules that create/modify objects.

  4. Version compatibility — The collection's policy is the two most recent NetBox releases; the latest release (v3.23.1, 2026-10) is CI-tested through 4.5 and declares no 4.6/4.7 support yet. Pin the collection and test against your NetBox minor.

  5. Filter with device_query_filters — e.g., has_primary_ip: 'true' to exclude devices without management IPs.

See references/ansible-patterns.md for module examples, inventory configuration, and lookup patterns.


Terraform Integration

The e-breuninger/netbox Terraform provider manages NetBox resources as infrastructure-as-code.

Key Guidelines

  1. Pin provider version to match NetBox version — NetBox makes breaking API changes in minor releases. Check the provider's compatibility matrix: v5.6.1+ covers NetBox 4.3–4.6.5; the v6.0 rewrite (RC as of 2026-09) targets 4.6.8–4.6.10; no release declares 4.7 support yet.

  2. Understand available_* resource lifecycle — netbox_available_ip_address and netbox_available_prefix allocate on create and cannot be "updated." They have unique lifecycle behavior compared to regular resources.

  3. Plan for state drift — If someone modifies NetBox outside Terraform, the next terraform plan shows drift. Decide on a drift remediation strategy.

  4. Coverage varies by area — The provider has strongest coverage for IPAM and virtualization. Other models may have incomplete resource support.

  5. Use data sources for read-only lookups — Most resources have corresponding data sources for referencing existing NetBox objects without managing them.

See references/terraform-patterns.md for provider setup, resource examples, and the available_* allocation pattern.


GitOps Workflows

NetBox integrates into GitOps pipelines as either the source of truth or a state mirror.

Common Architectures

PatternFlowBest For
Webhook-drivenNetBox change → webhook → CI/CD → deployReal-time reactions
Polling/exportCron → export NetBox data → Git commit → CI/CDBatch config generation
Ansible pullAnsible + nb_inventory → generate configs → pushPlaybook-driven workflows
Terraform unifiedTerraform manages NetBox + infrastructure togetherCloud + NetBox in sync

Key Guidelines

  1. Decide on a single source of truth — Either NetBox prescribes state and Git/automation enforces it, or Git is the source and NetBox mirrors it. Don't have two masters.

  2. Use config contexts for template data — Config contexts provide per-device, per-role, or per-site configuration data that Jinja2 templates consume during config generation.

  3. Webhook → CI/CD for real-time pipelines — Combine event rules with webhooks to trigger GitHub Actions, GitLab CI, or Jenkins on NetBox changes.

  4. Use tags as automation hints — Tag interfaces, devices, or prefixes to signal automation intent (e.g., tag "OSPF" on an interface to include it in OSPF config generation).

See references/gitops-workflows.md for pipeline architecture details and examples.


Cross-Cutting Concerns

These apply across all automation approaches:

  • Token management: Use scoped tokens with minimal permissions. Prefer v2 tokens (NetBox 4.5+) with Bearer auth. See netbox-api-integration for token format details.

  • Rate limiting: Large automation runs (bulk Ansible plays, Terraform applies) should implement backoff to avoid overwhelming the NetBox API. On 4.7+, large custom bulk writes can use ?background=true (HTTP 202 + job URL; poll the job for the result) to avoid proxy timeouts — see netbox-api-integration.

  • Pagination: All tools (pynetbox, Terraform provider, Ansible collection) handle pagination internally, but be aware of it when writing custom integrations. NetBox 4.6 adds cursor-based start pagination (an efficient alternative to deep offset scans) — see netbox-api-integration.

  • Idempotency: Ansible modules are idempotent by design. Terraform is declarative. Webhooks are fire-and-forget — implement idempotency on the receiver side.

  • Testing: Use NetBox's official Docker image for CI/CD testing environments (netboxcommunity/netbox:v4.7-5.1.1; tag = v<netbox>-<netbox-docker>). Spin up a disposable instance for integration tests.


Version Notes

NetBox 4.7 (2026-09-02)

  • Snapshot-aware conditions: changed/unchanged operators, snapshots.prechange.<attr> / snapshots.postchange.<attr> paths, regex operator; unresolvable attributes fail closed and log to netbox.event_rules. Snapshot values are raw (status, not status.value).
  • Webhook context: username and request_id removed — use request.user / request.id. send_webhook() lost its username argument: drain RQ queues before upgrading or queued webhook jobs fail with TypeError.
  • Webhook timeout: per-webhook timeout field and WEBHOOK_DEFAULT_TIMEOUT (default 60); must be less than RQ_DEFAULT_TIMEOUT, else NetBox refuses to start / save.
  • Event rules: action_object_type optional; plugins register action types (EventRuleAction); action_is_available flags rules whose plugin is gone.
  • Payload/API deltas that reach automation tools: selection custom fields are {value,label} objects in REST (and thus webhook data); config_context in device/VM output by default (omit it with ?omit=config_context on 4.7.3+; ?exclude= is a no-op on 4.7); ipam.Service protocol/ports deprecated for port_mappings; bulk write errors are per-object; ?background=true on bulk writes.
  • Ecosystem: netbox-docker 5.x (v4.7-5.1.1) requires NetBox 4.7+; Ansible collection and Terraform provider have not declared 4.7 support (see references).

NetBox 4.6 (2026-05-05)

  • Webhook context gains the request object; username/request_id deprecated.
  • Cursor-based start pagination for large reads.
  • On 4.5 only username/request_id exist in the webhook context.

References

DocumentWhen to Load
references/event-rules-and-webhooks.mdBuilding webhook integrations, configuring event rules, debugging webhook delivery
references/ansible-patterns.mdWriting Ansible playbooks that manage or query NetBox
references/terraform-patterns.mdManaging NetBox resources with Terraform
references/gitops-workflows.mdDesigning CI/CD pipelines with NetBox in the loop

Mitgelieferte Dateien

Das Modell liest diese Dateien bei Bedarf, während der Skill geladen ist. Sie werden als lesbare Dateien bereitgestellt und niemals ausgeführt.

Häufig gestellte Fragen

Was macht der KI-Skill Netbox Automation Patterns?

End-to-end automation patterns with NetBox — event-driven workflows (event rules, webhooks), infrastructure-as-code (Ansible, Terraform), and GitOps integration. Use when building, advising on, or troubleshooting NetBox automation pipelines.

Warum Netbox Automation Patterns in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. Netbox Automation Patterns besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich Netbox Automation Patterns in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/netboxlabs/skills/tree/main/skills/netbox-automation-patterns ein. TypingMind liest die Datei SKILL.md, bündelt die zugehörigen Dateien und installiert alles als Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können Netbox Automation Patterns nutzen?

Jedes Modell, das Sie in TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit Netbox Automation Patterns verwenden?

So viele Sie möchten. Solange ein Modell Skills unterstützt, können Sie Netbox Automation Patterns damit verwenden – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama und weitere – alles in TypingMind mit Ihren eigenen API-Schlüsseln.

Ist der KI-Skill Netbox Automation Patterns kostenlos?

Ja. Der Skill wird von netboxlabs auf GitHub unter der Lizenz Apache-2.0 veröffentlicht. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: eine Datei namens SKILL.md mit einem Namen und einer Beschreibung sowie allen Skripten, Vorlagen oder Referenzdateien, die das Modell möglicherweise benötigt. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und benötigen daher weder Server noch API-Schlüssel oder Laufzeitumgebung. Sie funktionieren mit jedem Modell.

Alle

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇