gmazoyer.netbox
Ansible Role: NetBox
This is an Ansible Role for installing NetBox on Debian/Ubuntu.
It installs everything that NetBox needs, including the PostgreSQL database, allowing you to set up a complete NetBox system on a single machine. If you already have a way to manage the web backend and frontend, you can choose not to install those.
Dependencies
None.
Role Variables
Here are the available variables with their default values:
PostgreSQL Database Setup
netbox_database: netbox
netbox_database_user: netbox
netbox_database_password: netbox
netbox_database_host: localhost # This ensures PostgreSQL gets set up
NetBox Version Source
netbox_version: latest
netbox_git_url: https://github.com/netbox-community/netbox.git
By default, the latest stable version is installed. To specify a version, you can use something like v3.5.1
.
Installation Directory
netbox_install_directory: /opt/netbox
Superuser Credentials
netbox_superuser_username: admin
netbox_superuser_password: admin
netbox_superuser_email: [email protected]
LDAP Authentication
You can use LDAP for authentication by enabling it and providing the configuration:
netbox_setup_ldap_auth: false
netbox_ldap_config: ""
Additional Python Packages
You can install other Python packages via a file named local_requirements.txt
. This is useful for packages like NAPALM:
netbox_local_requirements:
- napalm
…
NetBox Configuration
Provide NetBox settings as key: value
pairs. Note that the secret key will be generated automatically:
netbox_config:
ALLOWED_HOSTS:
- localhost
- 127.0.0.1
TIME_ZONE: "Europe/Paris"
…
Housekeeping Command
This command runs daily at 4:30 AM UTC using a systemd timer. You can configure it to run every 12 hours instead by using on_unit_active_sec: 12h
:
netbox_systemd_timers:
netbox-housekeeping:
enabled: true
command: "{{ netbox_virtualenv_path }}/bin/python {{ netbox_install_directory }}/netbox/manage.py housekeeping"
on_calendar: "*-*-* 4:30:00 UTC"
Backend Web Server and systemd Configuration
netbox_setup_systemd: false
netbox_gunicorn_address: 127.0.0.1
netbox_gunicorn_port: 8001
netbox_gunicorn_workers_number: 5
Frontend Web Server Setup
To configure the frontend web server:
netbox_setup_web_frontend: false
SSL/TLS for Frontend Web Server
netbox_web_tls: false
netbox_web_tls_port: 443
# netbox_web_tls_crt: /etc/pki/server.crt
# netbox_web_tls_key: /etc/pki/server.key
# netbox_web_tls_chain:
netbox_web_tls_redirect: false
Example Playbook
- hosts: netboxes
roles:
- { role: gmazoyer.netbox }
License
This Ansible Role is licensed under the GNU GPLv3. Please check the LICENSE
file for more details.
Some parts of this role contain MIT-licensed code (see 7c400dd
in the header). Check LICENSE-MIT
for more details.
Author Information
This role was created in 2017 by Guillaume Mazoyer.
A role to install and update NetBox.
ansible-galaxy install gmazoyer.netbox