Follow these steps to set up and configure NetBox for network automation.
pip install ansible
pip install netbox
export NETBOX_TOKEN=0415344f379c25ce5d9bb92ac1ea98c5c45789dc
export NETBOX_API=http://127.0.0.1:8000
Read more about integrating NetBox with Ansible for network automation on the following blog:
Getting Started with Network Automation: NetBox & AnsibleTo 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"
You can download the demo data from the official GitHub repository:
NetBox Demo Data RepositoryEnsure that your Docker containers are running and that the environment variables are correctly set before starting the setup process.