add bundle:netbox
This commit is contained in:
parent
f077346930
commit
b0d2503f08
8 changed files with 416 additions and 0 deletions
117
bundles/netbox/files/configuration.py
Normal file
117
bundles/netbox/files/configuration.py
Normal file
|
@ -0,0 +1,117 @@
|
|||
ALLOWED_HOSTS = [
|
||||
'${node.metadata.get('netbox/domain')}'
|
||||
]
|
||||
|
||||
DATABASE = {
|
||||
'NAME': 'netbox',
|
||||
'USER': 'netbox',
|
||||
'PASSWORD': '${repo.vault.password_for("netbox postgresql " + node.name)}',
|
||||
'HOST': 'localhost',
|
||||
'PORT': '',
|
||||
}
|
||||
|
||||
REDIS = {
|
||||
'tasks': {
|
||||
'HOST': 'localhost',
|
||||
'PORT': 6379,
|
||||
'PASSWORD': '',
|
||||
'DATABASE': 0,
|
||||
'DEFAULT_TIMEOUT': 300,
|
||||
'SSL': False,
|
||||
},
|
||||
'caching': {
|
||||
'HOST': 'localhost',
|
||||
'PORT': 6379,
|
||||
'PASSWORD': '',
|
||||
'DATABASE': 1,
|
||||
'DEFAULT_TIMEOUT': 300,
|
||||
'SSL': False,
|
||||
}
|
||||
}
|
||||
|
||||
SECRET_KEY = '${repo.vault.password_for('django secret netbox ' + node.name, length=50)}'
|
||||
|
||||
ADMINS = [
|
||||
% for name, email in sorted(node.metadata.get('netbox/admins', {})):
|
||||
['${name}', '${email}'],
|
||||
% endfor
|
||||
]
|
||||
|
||||
BANNER_TOP = ''
|
||||
BANNER_BOTTOM = ''
|
||||
|
||||
BASE_PATH = ''
|
||||
|
||||
CACHE_TIMEOUT = 0
|
||||
|
||||
CHANGELOG_RETENTION = ${node.metadata.get('netbox/changelog_retention_days', 90)}
|
||||
|
||||
CORS_ORIGIN_ALLOW_ALL = False
|
||||
CORS_ORIGIN_WHITELIST = [
|
||||
% for hostname in sorted(node.metadata.get('netbox/cors_allowlist', set())):
|
||||
'${hostname}',
|
||||
% endfor
|
||||
]
|
||||
CORS_ORIGIN_REGEX_WHITELIST = []
|
||||
|
||||
DEBUG = False
|
||||
|
||||
EMAIL = {
|
||||
'SERVER': 'localhost',
|
||||
'PORT': 25,
|
||||
'USERNAME': '',
|
||||
'PASSWORD': '',
|
||||
'TIMEOUT': 10, # seconds
|
||||
'FROM_EMAIL': '',
|
||||
}
|
||||
|
||||
ENFORCE_GLOBAL_UNIQUE = True
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'handlers': {
|
||||
'console': {
|
||||
'class': 'logging.StreamHandler',
|
||||
},
|
||||
},
|
||||
'root': {
|
||||
'handlers': ['console'],
|
||||
'level': 'WARNING',
|
||||
},
|
||||
}
|
||||
|
||||
LOGIN_REQUIRED = False
|
||||
|
||||
MAINTENANCE_MODE = False
|
||||
|
||||
MAX_PAGE_SIZE = 1000
|
||||
|
||||
MEDIA_ROOT = '/opt/netbox/media'
|
||||
|
||||
NAPALM_USERNAME = ''
|
||||
NAPALM_PASSWORD = ''
|
||||
NAPALM_TIMEOUT = 30
|
||||
NAPALM_ARGS = {}
|
||||
|
||||
PAGINATE_COUNT = 100
|
||||
|
||||
PLUGINS = {}
|
||||
|
||||
PREFER_IPV4 = False
|
||||
|
||||
# We use icinga for that.
|
||||
RELEASE_CHECK_URL = None
|
||||
|
||||
REMOTE_AUTH_BACKEND = 'netbox.authentication.RemoteUserBackend'
|
||||
|
||||
SCRIPTS_ROOT = '/opt/netbox/scripts'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
DATE_FORMAT = 'N j, Y'
|
||||
SHORT_DATE_FORMAT = 'Y-m-d'
|
||||
TIME_FORMAT = 'g:i a'
|
||||
SHORT_TIME_FORMAT = 'H:i:s'
|
||||
DATETIME_FORMAT = 'N j, Y g:i a'
|
||||
SHORT_DATETIME_FORMAT = 'Y-m-d H:i'
|
7
bundles/netbox/files/gunicorn_config.py
Normal file
7
bundles/netbox/files/gunicorn_config.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
command = '/opt/netbox/venv/bin/gunicorn'
|
||||
pythonpath = '/opt/netbox/src/netbox'
|
||||
bind = '127.0.0.1:22080'
|
||||
workers = ${min(node.metadata.get('vm/cpu', 1), 6)*2+1}
|
||||
threads = 1
|
||||
max_requests = 5000
|
||||
max_requests_jitter = 500
|
20
bundles/netbox/files/netbox-web.service
Normal file
20
bundles/netbox/files/netbox-web.service
Normal file
|
@ -0,0 +1,20 @@
|
|||
[Unit]
|
||||
Description=NetBox WSGI Service
|
||||
Documentation=https://netbox.readthedocs.io/en/stable/
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=netbox
|
||||
Group=netbox
|
||||
PIDFile=/var/tmp/netbox.pid
|
||||
WorkingDirectory=/opt/netbox/src
|
||||
ExecStart=/opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --config /opt/netbox/gunicorn_config.py netbox.wsgi
|
||||
|
||||
Restart=on-failure
|
||||
RestartSec=30
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
20
bundles/netbox/files/netbox-worker.service
Normal file
20
bundles/netbox/files/netbox-worker.service
Normal file
|
@ -0,0 +1,20 @@
|
|||
[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=/opt/netbox/src
|
||||
ExecStart=/opt/netbox/venv/bin/python /opt/netbox/src/netbox/manage.py rqworker
|
||||
|
||||
Restart=on-failure
|
||||
RestartSec=30
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Add table
Add a link
Reference in a new issue