respawner.netbox

Ansible Role: NetBox

This Ansible Role installs NetBox on Debian/Ubuntu systems.

It sets up all the necessary components for NetBox, including a PostgreSQL database, so you can run NetBox on a single machine. If you prefer to manage your web backend and frontend differently, you can skip setting those up.

Dependencies

None.

Role Variables

Here are the variables you can configure, along with their default values:

PostgreSQL Database Setup

netbox_database: netbox
netbox_database_user: netbox
netbox_database_password: netbox
netbox_database_host: localhost # This requires PostgreSQL to be set up

Getting NetBox

netbox_version: latest
netbox_git_url: https://github.com/netbox-community/netbox.git

By default, it will get the latest stable version. You can specify a version like v3.5.1.

Installation Directory for NetBox

netbox_install_directory: /opt/netbox

Superuser Credentials

netbox_superuser_username: admin
netbox_superuser_password: admin
netbox_superuser_email: [email protected]

LDAP Authentication

If you want to use LDAP for authentication, enable it and provide the necessary configuration (check the NetBox documentation):

netbox_setup_ldap_auth: false
netbox_ldap_config: ""

Installing Additional Python Packages

You can install extra packages using local_requirements.txt, like NAPALM or plugins:

netbox_local_requirements:
  - napalm

NetBox Configuration

NetBox configuration should be provided as key: value pairs. The secret key will be automatically generated:

netbox_config:
  ALLOWED_HOSTS:
    - localhost
    - 127.0.0.1
  TIME_ZONE: "Europe/Paris"

Housekeeping Command

A housekeeping command runs every day at 4:30 AM UTC using a systemd timer. You can also set it to run every 12 hours 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"

Web Server Configuration

This is for configuring the backend web server and systemd:

netbox_setup_systemd: false
netbox_gunicorn_address: 127.0.0.1
netbox_gunicorn_port: 8001
netbox_gunicorn_workers_number: 5

Frontend Web Server Configuration

Set this if you want to configure the frontend web server:

netbox_setup_web_frontend: false

SSL/TLS Configuration

Here are options for SSL/TLS on the 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

Here’s an example of how to use this role in a playbook:

- hosts: netboxes
  roles:
    - { role: gmazoyer.netbox }

License

This Ansible Role is under the GNU GPLv3 license. Check the LICENSE file for details. It includes parts of MIT-licensed code (see 7c400dd), noted in the header. See LICENSE-MIT for more information.

Author Information

This role was made by Guillaume Mazoyer in 2017.

Informazioni sul progetto

A role to install and update NetBox.

Installa
ansible-galaxy install respawner.netbox
Licenza
gpl-3.0
Download
364
Proprietario