NetBox Setup and Configuration Guide

Follow these steps to set up and configure NetBox for network automation.

Step 1: Install Dependencies

pip install ansible
pip install netbox
        
    

Step 2: Set Environment Variables

export NETBOX_TOKEN=0415344f379c25ce5d9bb92ac1ea98c5c45789dc
export NETBOX_API=http://127.0.0.1:8000
        
    

Step 3: Learn About NetBox and Ansible Integration

Read more about integrating NetBox with Ansible for network automation on the following blog:

Getting Started with Network Automation: NetBox & Ansible

Step 4: Import Demo Data into SQL Database

To populate your NetBox instance with demo data, follow the instructions below:

# Step 1: Drop the existing database
docker exec -it netbox_postgres bash -c "PGPASSWORD=netbox psql -U netbox -d postgres -c 'DROP DATABASE netbox;'"

# Step 2: Create a new database
docker exec -it netbox_postgres bash -c "PGPASSWORD=netbox psql -U netbox -d postgres -c 'CREATE DATABASE netbox;'"

# Step 3: Import the demo data from the SQL file
docker run -it --rm \
  --network container:netbox_postgres \
  -v $(pwd)/netbox-demo-v4.2.sql:/netbox-demo.sql \
  postgres:15 \
  bash -c "PGPASSWORD=netbox psql -h localhost -U netbox -d netbox < /netbox-demo.sql"
        
    

Step 5: SQL Demo Data Repository

You can download the demo data from the official GitHub repository:

NetBox Demo Data Repository

Note:

Ensure that your Docker containers are running and that the environment variables are correctly set before starting the setup process.

View Additional Configuration Files