diff --git a/data/common/common.yaml b/data/common/common.yaml --- a/data/common/common.yaml +++ b/data/common/common.yaml @@ -3542,7 +3542,7 @@ - localhost - "::1" -netbox::version: 2.9.3 +netbox::version: "2.11.12" netbox::user: netbox netbox::db::host: localhost netbox::db::port: 5432 diff --git a/site-modules/profile/manifests/netbox.pp b/site-modules/profile/manifests/netbox.pp --- a/site-modules/profile/manifests/netbox.pp +++ b/site-modules/profile/manifests/netbox.pp @@ -137,14 +137,17 @@ notify => Systemd::Unit_file['netbox.service'], } - ::systemd::unit_file {'netbox.service': - ensure => present, - content => template('profile/netbox/netbox.service.erb'), - } ~> service {'netbox': - ensure => 'running', - enable => true, - require => [File['netbox-gunicorn-config'], - File['netbox-configuration']], + ['netbox', 'netbox-rq'].each |$service| { + + ::systemd::unit_file {"${service}.service": + ensure => present, + content => template("profile/netbox/${service}.service.erb"), + } ~> service {$service: + ensure => 'running', + enable => true, + require => [File['netbox-gunicorn-config'], + File['netbox-configuration']], + } } } diff --git a/site-modules/profile/templates/netbox/configuration.py.erb b/site-modules/profile/templates/netbox/configuration.py.erb --- a/site-modules/profile/templates/netbox/configuration.py.erb +++ b/site-modules/profile/templates/netbox/configuration.py.erb @@ -36,8 +36,10 @@ # 'SENTINEL_SERVICE': 'netbox', 'PASSWORD': '<%= @redis_password %>', 'DATABASE': 0, - 'DEFAULT_TIMEOUT': 300, 'SSL': False, + # Set this to True to skip TLS certificate verification + # This can expose the connection to attacks, be careful + # 'INSECURE_SKIP_TLS_VERIFY': False, }, 'caching': { 'HOST': '<%= @redis_host %>', @@ -47,8 +49,10 @@ # 'SENTINEL_SERVICE': 'netbox', 'PASSWORD': '<%= @redis_password %>', 'DATABASE': 1, - 'DEFAULT_TIMEOUT': 300, 'SSL': False, + # Set this to True to skip TLS certificate verification + # This can expose the connection to attacks, be careful + # 'INSECURE_SKIP_TLS_VERIFY': False, } } @@ -68,7 +72,7 @@ # Specify one or more name and email address tuples representing NetBox administrators. These people will be notified of # application errors (assuming correct email settings are provided). ADMINS = [ - # ['John Doe', 'jdoe@example.com'], + # ('John Doe', 'jdoe@example.com'), ] # URL schemes that are allowed within links in NetBox @@ -84,12 +88,12 @@ # Text to include on the login page above the login form. HTML is allowed. BANNER_LOGIN = '' -# Base URL path if accessing NetBox within a directory. For example, if installed at http://example.com/netbox/, set: +# Base URL path if accessing NetBox within a directory. For example, if installed at https://example.com/netbox/, set: # BASE_PATH = 'netbox/' BASE_PATH = '' -# Cache timeout in seconds. Set to 0 to dissable caching. Defaults to 900 (15 minutes) -CACHE_TIMEOUT = 900 +# Cache timeout in seconds. Defaults to zero (disabled). +CACHE_TIMEOUT = 0 # Maximum number of days to retain logged changes. Set to 0 to retain changes indefinitely. (Default: 90) CHANGELOG_RETENTION = 90 @@ -146,6 +150,10 @@ # https://docs.djangoproject.com/en/stable/topics/logging/ LOGGING = {} +# Automatically reset the lifetime of a valid session upon each authenticated request. Enables users to remain +# authenticated to NetBox indefinitely. +LOGIN_PERSISTENCE = False + # Setting this to True will permit only authenticated users to access any part of NetBox. By default, anonymous users # are permitted to access most data in NetBox (excluding secrets) but not make any changes. LOGIN_REQUIRED = False @@ -157,6 +165,9 @@ # Setting this to True will display a "maintenance mode" banner at the top of every page. MAINTENANCE_MODE = False +# The URL to use when mapping physical addresses or GPS coordinates +MAPS_URL = 'https://maps.google.com/?q=' + # An API consumer can request an arbitrary number of objects =by appending the "limit" parameter to the URL (e.g. # "?limit=1000"). This setting defines the maximum limit. Setting it to 0 or None will allow an API consumer to request # all objects by specifying "?limit=0". @@ -186,7 +197,7 @@ # NAPALM timeout (in seconds). (Default: 30) NAPALM_TIMEOUT = 30 -# NAPALM optional arguments (see http://napalm.readthedocs.io/en/latest/support/#optional-arguments). Arguments must +# NAPALM optional arguments (see https://napalm.readthedocs.io/en/latest/support/#optional-arguments). Arguments must # be provided as a dictionary. NAPALM_ARGS = {} @@ -233,10 +244,16 @@ # this setting is derived from the installed location. REPORTS_ROOT = '<%= @reports_dir %>' +# Maximum execution time for background tasks, in seconds. +RQ_DEFAULT_TIMEOUT = 300 + # The file path where custom scripts will be stored. A trailing slash is not needed. Note that the default value of # this setting is derived from the installed location. SCRIPTS_ROOT = '<%= @scripts_directory %>' +# The name to use for the session cookie. +SESSION_COOKIE_NAME = 'sessionid' + # By default, NetBox will store session data in the database. Alternatively, a file path can be specified here to use # local file storage instead. (This can be useful for enabling authentication on a standby instance with read-only # database access.) Note that the user as which NetBox runs must have read and write permissions to this path. diff --git a/site-modules/profile/templates/netbox/gunicorn.py.erb b/site-modules/profile/templates/netbox/gunicorn.py.erb --- a/site-modules/profile/templates/netbox/gunicorn.py.erb +++ b/site-modules/profile/templates/netbox/gunicorn.py.erb @@ -1,10 +1,9 @@ - # The IP address (typically localhost) and port that the Netbox WSGI process should listen on bind = '<%= @gunicorn_binding %>:<%= @gunicorn_port %>' # Number of gunicorn workers to spawn. This should typically be 2n+1, where # n is the number of CPU cores present. -workers = 2 +workers = 5 # Number of threads per worker process threads = 3 diff --git a/site-modules/profile/templates/netbox/netbox-rq.service.erb b/site-modules/profile/templates/netbox/netbox-rq.service.erb new file mode 100644 --- /dev/null +++ b/site-modules/profile/templates/netbox/netbox-rq.service.erb @@ -0,0 +1,21 @@ +[Unit] +Description=NetBox Request Queue Worker +Documentation=https://netbox.readthedocs.io/en/stable/ +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple + +User=netbox +Group=netbox +WorkingDirectory=<%= @install_path %> + +ExecStart=<%= @install_path %>/venv/bin/python3 <%= @install_path %>/netbox/manage.py rqworker + +Restart=on-failure +RestartSec=30 +PrivateTmp=true + +[Install] +WantedBy=multi-user.target