Collection of assorted tools and CLI scripts for NetBox. [1]
- create and enter python environment for running the scripts
python3 -m venv venv
. ./venv/bin/activate
pip3 install -r requirements.txt # [2]
- Create your "env" file. (see.
env.example
) . ~/Path/To/netbox-tools/env
- ...
- Profit!
- add interface and allocate IP address from VLAN (if specified)
- add service to specified device
- example:
./netbox_add_service.py vm-example-1 "service-name.example.com" tcp/80
- set speicied device or VM interface to trunk mode
- lookup all VLANs withing given range
- and tag interface (and it's LAG members) with existing VLANs
- example:
./netbox_set_if_vlans.py srv-example-1 bond0 1,10,20-39,100
- create new VM with "eth0" interface, allocate ip address and create tcp/22 service
- for usage, see
./netbox_create_vm.py -h
- generate yaml file with config context of specified device or vm
- generate yaml file with networking configuration of specified device or vm
- for format, see: ansible-roles-common/linux-networking
- generate yaml file with virtual configuration fo specified vm
- for format, see: ansible-roles/common/virtual/preseed-ng
- generate bind zone file for specified domain
- ip addresses are gathered from devices, VMs, IPs and services with FQDNs
- example:
./netbox_generate_ns_zone.py example.com
[1] https://github.com/netbox-community/netbox [2] https://pynetbox.readthedocs.io/en/latest/