Configuration Files

Below are the necessary configuration files for setting up NetBox.

ansible.cfg

[defaults]
inventory = inventory.yml
        
    

inventory.yml

---
plugin: netbox.netbox.nb_inventory
validate_certs: false
config_context: false
group by: 
  - site
  - role
  - manufacturer
        
    

docker-compose.yml

version: '3.4'

services:
  postgres:
    image: postgres:15-alpine
    container_name: netbox_postgres
    restart: unless-stopped
    env_file: .env
    environment:
      POSTGRES_DB: netbox
      POSTGRES_USER: netbox
      POSTGRES_PASSWORD: netbox
    volumes:
      - postgres_data:/var/lib/postgresql/data

  redis:
    image: redis:7-alpine
    container_name: netbox_redis
    restart: unless-stopped

  netbox:
    image: netboxcommunity/netbox:latest
    container_name: netbox
    depends_on:
      - postgres
      - redis
    env_file: .env
    environment:
      - ALLOWED_HOSTS=*
      - DB_NAME=netbox
      - DB_USER=netbox
      - DB_PASSWORD=netbox
      - DB_HOST=postgres
      - DB_PORT=5432
      - REDIS_HOST=netbox_redis  
      - REDIS_PORT=6379  
      - SECRET_KEY:"fowefnqfoihfowpfehfqowfoewkdna59213879foiwejfefasl"  
    ports:
      - "8000:8080"
    volumes:
      - netbox_media:/opt/netbox/netbox/media
      - netbox_reports:/opt/netbox/netbox/reports
      - netbox_scripts:/opt/netbox/netbox/scripts
    restart: unless-stopped

  worker:
    image: netboxcommunity/netbox:latest
    container_name: netbox_worker
    depends_on:
      - netbox
    entrypoint: /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py rqworker
    restart: unless-stopped

volumes:
  postgres_data:
  netbox_media:
  netbox_reports:
  netbox_scripts:
        
    

.env

POSTGRES_DB=netbox
POSTGRES_USER=netbox
POSTGRES_PASSWORD=netbox
ALLOWED_HOSTS=*
DB_NAME=netbox
DB_USER=netbox
DB_PASSWORD=netbox
DB_HOST=postgres
DB_PORT=5432
SECRET_KEY=fowefnqfoihfowpfehfqowfoewkdna59213879foiwejfefasl
        
    
Back to Setup Guide