This repository contains the official code, scripts, and automation playbooks for the NetBox Automation with Ansible & Python Masterclass course.
π Enroll in the Course on Udemy
- Master NetBox as a Single Source of Truth (SSoT) for multi-vendor network automation (Cisco, Fortinet, Juniper, Palo Alto, Arista).
- Full-stack NetBox Installation: Deploy using Docker on Windows (WSL), MacOS, and AWS EC2.
- Lifecycle Management: Automate NetBox using Ansible modules and Python libraries (pynetbox & Requests).
- Organizational Hierarchies: Build and manage Regions, Sites, Locations, and Tenants at scale.
- Device Modeling: Orchestrate End-to-End Rack and Device modeling, including modular chassis management.
- IPAM & VLANs: Implement advanced strategies, including auto-assignment of Management IPs and SVI creation.
- Infrastructure Components: Manage Circuits, Providers, VPNs, and Wireless LANs.
- REST API Mastery: Use Postman and Swagger for advanced Filtering and Pagination.
- Next-Gen Features: Utilize NetBox Branching (Git-style) and Co-pilot for safe data staging.
- Data Integration: Sync NetBox with external sources like GitHub and AWS S3.
- Dynamic Inventory: Leverage the Ansible Inventory Plugin to use NetBox for real-time network deployments.
- Custom Scripts: Develop internal NetBox scripts for bulk tasks and compliance checks.
- Configuration Management: Render device configurations using Config Contexts and Jinja2 Templates.
- Virtualization & Cabling: Model Virtual Machines, Server Clusters, and Physical Cabling.
- Plugins & Extensions: Install and configure popular plugins like BGP and Topology View.
- Network Discovery: Explore next-gen discovery with NetBox Diode and Orb Agent.
- Administrative Automation: Automate Custom Fields, Journal Entries, and Webhook Event Rules.
- NetBox Design Philosophy & Architecture Explained
- Installation: Windows (Docker/WSL2), MacOS (Docker Desktop), and AWS EC2
- VS Code Setup for Network Automation
- Accessing NetBox Public Demo & Labs Cloud Instance
- Adding Sites, Manufacturers, Device Roles, and Types
- Understanding NetBox Data Relationships
- Strategic Planning: Importing Data via CSV (Tenants, Regions, Sites)
- Enabling Co-pilot in Community Edition
- Git-style Branching for staging infrastructure changes
- NetBox Token V1 vs V2 Security
- API Operations: GET, POST, PUT, PATCH using Postman
- Handling Pagination and Bulk Operations
- Ansible Inventory setup & URI Module examples
- Python Integration: Using Requests and the official PyNetBox library
- Idempotency: Implementing custom checks to prevent data noise
- Full Organizational Data reset scripts
- Rack Modeling: Manufacturers, Roles, and types at scale
- Device Inventory: Manual vs. Programmatic onboarding
- Modular Systems: Chassis and Module Slot assignment (Cisco/Multi-vendor)
- Creating Config Context Profiles and JSON Schemas
- Rendering device configurations via Jinja2 Templates
- NetBox as a Dynamic Source for Ansible
- Discovering devices and assigning Primary IPs via automation
- Deploying rendered configs to live POC Lab devices
- Cabling: Connecting interfaces, Power Panels, and PDUs
- Circuits: Modeling Providers and Terminations via Python/Ansible
- Automating VLAN SVI creation and IP Prefix assignments
- VPN Modeling: IPSec Profiles and DMVPN Tunnel Terminations
- Wireless Groups and WLAN management
- Modeling Virtual Machines (VMs) and Server Clusters
- Connecting Server cables to Network Switches
- Automation of Custom Fields, Export Templates, and Webhooks
- Setting up Data Sources (AWS S3, Git, Local)
- Plugins: BGP, Topology View, and NetBox Diode/Orb Agent discovery
Looking to expand your automation toolkit? Check out my other highly-rated courses:
- Python for Network Engineers β Master Python from scratch with a focus on real-world NetDevOps use cases.
- Ansible Course for Network Engineers β Master infrastructure-as-code for Cisco, NetBox, and Palo Alto environments.
This project uses uv for Python dependency management. Follow these two steps to build your automation environment.
Ensure you have uv installed on your machine.
# macOS / Linux
curl -LsSf [https://astral.sh/uv/install.sh](https://astral.sh/uv/install.sh) | sh
# Windows
powershell -c "irm [https://astral.sh/uv/install.ps1](https://astral.sh/uv/install.ps1) | iex"First, install the Python tools (Ansible engine, pynetbox, and helper libraries) into a virtual environment.
uv syncWhat this does: It reads pyproject.toml and creates an isolated Python environment so this project doesn't conflict with other work on your machine.
Next, install the specific Ansible modules needed to talk to Netbox (defined in requirements.yml).
uv run ansible-galaxy collection install -r requirements.ymlWhat this does: It downloads the netbox.netbox collection from Ansible Galaxy.
Note: We use uv run to ensure we use the local version of Ansible installed in Step 1, not your system version.
Check that the environment is correctly using the local Ansible version.
uv run ansible --versionMaintained by NetworkEvolution