Skip to main content

Dynamic configuration files and images from NetBox.

Project description

Netbox Ninja Plugin

Development Status

A NetBox plugin for generating dynamic text files and images using Jinja2 templates.

Overview

Netbox Ninja Plugin enables dynamic content generation in NetBox through Jinja2 templates. It supports both text file generation and SVG image creation from draw.io XML templates, seamlessly integrating with NetBox's data model.

Note: This plugin is currently in beta. While it's functional, some features are still under development and the API may change in future releases.

Key Features

  • Dynamic text file generation using Jinja2 templates
  • Template-based SVG image generation from draw.io XML format
  • Direct integration with NetBox's data model
  • REST API endpoints for template management
  • Support for object-specific template rendering

Requirements

  • NetBox v4.2.7 or later
  • drawio-export-api Docker container (optional, required for image generation)

Quick Start

  1. Install the plugin:
pip install netbox-ninja-plugin
  1. Add to NetBox configuration:
PLUGINS = [
    'netbox_ninja_plugin',
]
  1. Configure the plugin (see CONFIGURATION.md for detailed options):
PLUGINS_CONFIG = {
    "netbox_ninja_plugin": {
        "target_models": {
            "dcim": ["device", "interface", "site", "region"],
            "ipam": ["prefix"],
        },
        "jinja_model_querysets": {
            "dcim": ["device", "interface", "site", "region"],
            "ipam": ["prefix"],
        },
        "drawio_export_api": {
            "url": "https://drawio-export-api:443/svg",
            "token": "your-token",
            "pem_file_path": "/path/to/drawio_export_api.pem",
            "verify_tls": True,
            "timeout": 60,
        },
    }
}

Usage

Template Creation

  1. Navigate to NetBox's Ninja Templates section
  2. Create a new template with:
    • Name: Template identifier
    • Output type: Text or Draw.io format
    • Object types: NetBox objects to associate with the template
    • Template code: Your Jinja2 template

Template Variables

  • Access NetBox objects using object queries, e.g. {{ sites.first() }} or {{ regions.get(slug='region1') }}
  • For object-specific templates, use {{ target_object }} to reference the current object

For detailed examples and use cases, see EXAMPLES.md.

Security Note

The plugin currently doesn't enforce object-level permissions in templates. Exercise caution when exposing data through templates, as users may access data beyond their normal permissions.

Documentation

  • Examples - Detailed usage examples and tutorials
  • Configuration - Detailed configuration options and examples

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netbox_ninja_plugin-0.1.4.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

netbox_ninja_plugin-0.1.4-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file netbox_ninja_plugin-0.1.4.tar.gz.

File metadata

  • Download URL: netbox_ninja_plugin-0.1.4.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for netbox_ninja_plugin-0.1.4.tar.gz
Algorithm Hash digest
SHA256 641ad9ef530a056bfc1bea2ccb7cec17f744796a8f36392a1b5e57294702a8bf
MD5 78d7b9e5c290402da91aba6cc951de5f
BLAKE2b-256 7a57f2a310f962c98a422422323a44f001b3ca9217fc289fc8a2aafbc62486f0

See more details on using hashes here.

File details

Details for the file netbox_ninja_plugin-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for netbox_ninja_plugin-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a4ff348ef3d28ff569ce8e2d740cfe6ac7f945b0e85a17a6d28c0f7cb685d006
MD5 ef72c6ad4a075afb3cfab982cd36a153
BLAKE2b-256 867c4ab102aad13ee458004b66721e60a4817e857611dd9b5bc63257c97b8f1b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page