Page MenuHomeDevCentral

D3469.id8972.diff
No OneTemporary

D3469.id8972.diff

diff --git a/GIDs b/GIDs
--- a/GIDs
+++ b/GIDs
@@ -3,6 +3,7 @@
829 nasqueron-irc
835 opensearch
842 nasqueron-dev-docker
+1001 netbox
3001 ops
#3002 is intentionally left unassigned
3003 deployment
diff --git a/PORTS b/PORTS
--- a/PORTS
+++ b/PORTS
@@ -1,3 +1,6 @@
+devserver
+ 17000 NetBox
+
reserved-for-legacy-docker-migration-medium-priority
3000 Mastodon public HTTP
4000 Mastodon streaming HTTP
diff --git a/UIDs b/UIDs
--- a/UIDs
+++ b/UIDs
@@ -4,6 +4,7 @@
833 viperserv
834 tc2
835 opensearch
+1001 netbox
3004 mediawiki
6000 mailbox
9001 salt
diff --git a/pillar/credentials/vault.sls b/pillar/credentials/vault.sls
--- a/pillar/credentials/vault.sls
+++ b/pillar/credentials/vault.sls
@@ -114,6 +114,10 @@
- ops/secrets/dbserver/cluster-A/users/postfix
- ops/secrets/mailserver/security
+ netbox:
+ - ops/secrets/dbserver/windriver-pgsql/users/netbox
+ - ops/secrets/nasqueron/netbox/key
+
opensearch:
- ops/secrets/nasqueron/opensearch/infra-logs/internal_users/admin
- ops/secrets/nasqueron/opensearch/infra-logs/internal_users/dashboards
diff --git a/pillar/netbox/netbox.sls b/pillar/netbox/netbox.sls
new file mode 100644
--- /dev/null
+++ b/pillar/netbox/netbox.sls
@@ -0,0 +1,14 @@
+# -------------------------------------------------------------
+# Salt — NetBox configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+netbox:
+ app_port: 17000
+ db:
+ host: localhost
+ name: netbox
+ credential: dbserver/windriver-pgsql/users/netbox
+ secret_key: nasqueron/netbox/key
diff --git a/pillar/nodes/nodes.sls b/pillar/nodes/nodes.sls
--- a/pillar/nodes/nodes.sls
+++ b/pillar/nodes/nodes.sls
@@ -276,6 +276,7 @@
roles:
- devserver
- dbserver-mysql
+ - netbox
- webserver-alkane
- webserver-alkane-dev
- webserver-legacy
diff --git a/pillar/top.sls b/pillar/top.sls
--- a/pillar/top.sls
+++ b/pillar/top.sls
@@ -71,6 +71,7 @@
- devserver.datacubes
- devserver.ports
- devserver.repos
+ - netbox.netbox
- observability.prometheus
- webserver.labs
- webserver.wwwroot51
diff --git a/roles/netbox/netbox/config.sls b/roles/netbox/netbox/config.sls
new file mode 100644
--- /dev/null
+++ b/roles/netbox/netbox/config.sls
@@ -0,0 +1,42 @@
+# -------------------------------------------------------------
+# NetBox
+# -------------------------------------------------------------
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% set db = pillar["netbox"]["db"] %}
+{% set secret_key = pillar["netbox"]["secret_key"] %}
+
+/srv/netbox/netbox/netbox/netbox/configuration.py:
+ file.managed:
+ - source: salt://roles/netbox/netbox/files/configuration.py
+ - mode: 400
+ - user: netbox
+ - group: netbox
+ - template: jinja
+ - context:
+ db:
+ name: {{ db["name"] }}
+ user: {{ salt["credentials.get_username"](db["credential"]) }}
+ password: {{ salt["credentials.get_password"](db["credential"]) }}
+ host: {{ db["host"] }}
+ secret_key: {{ salt["credentials.get_password"](secret_key) }}
+
+# -------------------------------------------------------------
+# WSGI configuration
+# -------------------------------------------------------------
+
+/srv/netbox/gunicorn.py:
+ file.managed:
+ - source: salt://roles/netbox/netbox/files/gunicorn.py
+ - mode: 644
+ - template: jinja
+ - context:
+ app_port: {{ pillar["netbox"]["app_port"] }}
+
+/var/log/netbox:
+ file.directory:
+ - user: netbox
+ - group: netbox
+ - mode: 755
diff --git a/roles/netbox/netbox/files/configuration.py b/roles/netbox/netbox/files/configuration.py
new file mode 100644
--- /dev/null
+++ b/roles/netbox/netbox/files/configuration.py
@@ -0,0 +1,280 @@
+# -------------------------------------------------------------
+# netbox configuration
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/netbox/netbox/files/configuration.py
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+
+#########################
+# #
+# Required settings #
+# #
+#########################
+
+# This is a list of valid fully-qualified domain names (FQDNs) for the NetBox server. NetBox will not permit write
+# access to the server via any other hostnames. The first FQDN in the list will be treated as the preferred name.
+#
+# Example: ALLOWED_HOSTS = ['netbox.example.com', 'netbox.internal.local']
+ALLOWED_HOSTS = ["*"]
+
+# PostgreSQL database configuration. See the Django documentation for a complete list of available parameters:
+# https://docs.djangoproject.com/en/stable/ref/settings/#databases
+DATABASE = {
+ "NAME": "{{ db.name }}", # Database name
+ "USER": "{{ db.user }}", # PostgreSQL username
+ "PASSWORD": "{{ db.password }}", # PostgreSQL password
+ "HOST": "{{ db.host }}", # Database server
+ "PORT": "", # Database port (leave blank for default)
+ "CONN_MAX_AGE": 300, # Max database connection age
+}
+
+# Redis database settings. Redis is used for caching and for queuing background tasks such as webhook events. A separate
+# configuration exists for each. Full connection details are required in both sections, and it is strongly recommended
+# to use two separate database IDs.
+REDIS = {
+ "tasks": {
+ "HOST": "localhost",
+ "PORT": 6379,
+ # Comment out `HOST` and `PORT` lines and uncomment the following if using Redis Sentinel
+ # 'SENTINELS': [('mysentinel.redis.example.com', 6379)],
+ # 'SENTINEL_SERVICE': 'netbox',
+ "USERNAME": "",
+ "PASSWORD": "",
+ "DATABASE": 0,
+ "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,
+ # Set a path to a certificate authority, typically used with a self signed certificate.
+ # 'CA_CERT_PATH': '/etc/ssl/certs/ca.crt',
+ },
+ "caching": {
+ "HOST": "localhost",
+ "PORT": 6379,
+ # Comment out `HOST` and `PORT` lines and uncomment the following if using Redis Sentinel
+ # 'SENTINELS': [('mysentinel.redis.example.com', 6379)],
+ # 'SENTINEL_SERVICE': 'netbox',
+ "USERNAME": "",
+ "PASSWORD": "",
+ "DATABASE": 1,
+ "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,
+ # Set a path to a certificate authority, typically used with a self signed certificate.
+ # 'CA_CERT_PATH': '/etc/ssl/certs/ca.crt',
+ },
+}
+
+# This key is used for secure generation of random numbers and strings. It must never be exposed outside of this file.
+# For optimal security, SECRET_KEY should be at least 50 characters in length and contain a mix of letters, numbers, and
+# symbols. NetBox will not run without this defined. For more information, see
+# https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-SECRET_KEY
+SECRET_KEY = "{{ secret_key }}"
+
+
+#########################
+# #
+# Optional settings #
+# #
+#########################
+
+# 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'),
+]
+
+# Permit the retrieval of API tokens after their creation.
+ALLOW_TOKEN_RETRIEVAL = False
+
+# Enable any desired validators for local account passwords below. For a list of included validators, please see the
+# Django documentation at https://docs.djangoproject.com/en/stable/topics/auth/passwords/#password-validation.
+AUTH_PASSWORD_VALIDATORS = [
+ # {
+ # 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
+ # 'OPTIONS': {
+ # 'min_length': 10,
+ # }
+ # },
+]
+
+# Base URL path if accessing NetBox within a directory. For example, if installed at https://example.com/netbox/, set:
+# BASE_PATH = 'netbox/'
+BASE_PATH = ""
+
+# API Cross-Origin Resource Sharing (CORS) settings. If CORS_ORIGIN_ALLOW_ALL is set to True, all origins will be
+# allowed. Otherwise, define a list of allowed origins using either CORS_ORIGIN_WHITELIST or
+# CORS_ORIGIN_REGEX_WHITELIST. For more information, see https://github.com/ottoyiu/django-cors-headers
+CORS_ORIGIN_ALLOW_ALL = False
+CORS_ORIGIN_WHITELIST = [
+ # 'https://hostname.example.com',
+]
+CORS_ORIGIN_REGEX_WHITELIST = [
+ # r'^(https?://)?(\w+\.)?example\.com$',
+]
+
+# Set to True to enable server debugging. WARNING: Debugging introduces a substantial performance penalty and may reveal
+# sensitive information about your installation. Only enable debugging while performing testing. Never enable debugging
+# on a production system.
+DEBUG = False
+
+# Set the default preferred language/locale
+DEFAULT_LANGUAGE = "en-us"
+
+# Email settings
+EMAIL = {
+ "SERVER": "localhost",
+ "PORT": 25,
+ "USERNAME": "",
+ "PASSWORD": "",
+ "USE_SSL": False,
+ "USE_TLS": False,
+ "TIMEOUT": 10, # seconds
+ "FROM_EMAIL": "",
+}
+
+# Exempt certain models from the enforcement of view permissions. Models listed here will be viewable by all users and
+# by anonymous users. List models in the form `<app>.<model>`. Add '*' to this list to exempt all models.
+EXEMPT_VIEW_PERMISSIONS = [
+ # 'dcim.site',
+ # 'dcim.region',
+ # 'ipam.prefix',
+]
+
+# HTTP proxies NetBox should use when sending outbound HTTP requests (e.g. for webhooks).
+# HTTP_PROXIES = {
+# 'http': 'http://10.10.1.10:3128',
+# 'https': 'http://10.10.1.10:1080',
+# }
+
+# IP addresses recognized as internal to the system. The debugging toolbar will be available only to clients accessing
+# NetBox from an internal IP.
+INTERNAL_IPS = ("127.0.0.1", "::1")
+
+# Enable custom logging. Please see the Django documentation for detailed guidance on configuring custom logs:
+# https://docs.djangoproject.com/en/stable/topics/logging/
+LOGGING = {
+ "version": 1,
+ "disable_existing_loggers": False,
+ "handlers": {
+ "file": {
+ "level": "INFO",
+ "class": "logging.handlers.WatchedFileHandler",
+ "filename": "/var/log/netbox/netbox.log",
+ },
+ },
+ "loggers": {
+ "django": {
+ "handlers": ["file"],
+ "level": "INFO",
+ },
+ "netbox": {
+ "handlers": ["file"],
+ "level": "INFO",
+ },
+ },
+}
+
+# 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 but not make any changes.
+LOGIN_REQUIRED = False
+
+# The length of time (in seconds) for which a user will remain logged into the web UI before being prompted to
+# re-authenticate. (Default: 1209600 [14 days])
+LOGIN_TIMEOUT = None
+
+# The view name or URL to which users are redirected after logging out.
+LOGOUT_REDIRECT_URL = "home"
+
+# The file path where uploaded media such as image attachments are stored. A trailing slash is not needed. Note that
+# the default value of this setting is derived from the installed location.
+# MEDIA_ROOT = '/opt/netbox/netbox/media'
+
+# By default uploaded media is stored on the local filesystem. Using Django-storages is also supported. Provide the
+# class path of the storage driver in STORAGE_BACKEND and any configuration options in STORAGE_CONFIG. For example:
+# STORAGE_BACKEND = 'storages.backends.s3boto3.S3Boto3Storage'
+# STORAGE_CONFIG = {
+# 'AWS_ACCESS_KEY_ID': 'Key ID',
+# 'AWS_SECRET_ACCESS_KEY': 'Secret',
+# 'AWS_STORAGE_BUCKET_NAME': 'netbox',
+# 'AWS_S3_REGION_NAME': 'eu-west-1',
+# }
+
+# Expose Prometheus monitoring metrics at the HTTP endpoint '/metrics'
+METRICS_ENABLED = True
+
+# Enable installed plugins. Add the name of each plugin to the list.
+PLUGINS = []
+
+# Plugins configuration settings. These settings are used by various plugins that the user may have installed.
+# Each key in the dictionary is the name of an installed plugin and its value is a dictionary of settings.
+# PLUGINS_CONFIG = {
+# 'my_plugin': {
+# 'foo': 'bar',
+# 'buzz': 'bazz'
+# }
+# }
+
+# Remote authentication support
+REMOTE_AUTH_ENABLED = False
+REMOTE_AUTH_BACKEND = "netbox.authentication.RemoteUserBackend"
+REMOTE_AUTH_HEADER = "HTTP_REMOTE_USER"
+REMOTE_AUTH_AUTO_CREATE_USER = True
+REMOTE_AUTH_DEFAULT_GROUPS = []
+REMOTE_AUTH_DEFAULT_PERMISSIONS = {}
+
+# This repository is used to check whether there is a new release of NetBox available. Set to None to disable the
+# version check or use the URL below to check for release in the official NetBox repository.
+RELEASE_CHECK_URL = None
+# RELEASE_CHECK_URL = 'https://api.github.com/repos/netbox-community/netbox/releases'
+
+# The file path where custom reports will be stored. A trailing slash is not needed. Note that the default value of
+# this setting is derived from the installed location.
+# REPORTS_ROOT = '/opt/netbox/netbox/reports'
+
+# 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 = '/opt/netbox/netbox/scripts'
+
+# The name to use for the csrf token cookie.
+CSRF_COOKIE_NAME = "csrftoken"
+
+# 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.
+SESSION_FILE_PATH = None
+
+# Localization
+ENABLE_LOCALIZATION = False
+
+# Time zone (default: UTC)
+TIME_ZONE = "UTC"
+
+# Date/time formatting. See the following link for supported formats:
+# https://docs.djangoproject.com/en/stable/ref/templates/builtins/#date
+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"
diff --git a/roles/netbox/netbox/files/gunicorn.py b/roles/netbox/netbox/files/gunicorn.py
new file mode 100644
--- /dev/null
+++ b/roles/netbox/netbox/files/gunicorn.py
@@ -0,0 +1,24 @@
+# -------------------------------------------------------------
+# Configure gunicorn
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: BSD-2-Clause
+# -------------------------------------------------------------
+
+
+# The IP address (typically localhost) and port that the NetBox WSGI process should listen on
+bind = "127.0.0.1:{{ app_port }}"
+
+# Number of gunicorn workers to spawn. This should typically be 2n+1, where
+# n is the number of CPU cores present.
+workers = {{grains["num_cpus"] + 1}}
+
+# Number of threads per worker process
+threads = 3
+
+# Timeout (in seconds) for a request to complete
+timeout = 120
+
+# The maximum number of requests a worker can handle before being respawned
+max_requests = 5000
+max_requests_jitter = 500
diff --git a/roles/netbox/netbox/files/rc/netbox b/roles/netbox/netbox/files/rc/netbox
new file mode 100644
--- /dev/null
+++ b/roles/netbox/netbox/files/rc/netbox
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+# PROVIDE: netbox
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+
+# -------------------------------------------------------------
+# NetBox
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/netbox/server/files/rc/netbox
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# netbox_enable (bool): Set it to YES to enable netbox.
+# Default is "NO".
+# netbox_user (user): Set user to run netbox.
+# Default is "netbox".
+# netbox_port (int): Set port to run netbox.
+# Default is "17000".
+
+. /etc/rc.subr
+
+name=netbox
+rcvar=netbox_enable
+
+load_rc_config $name
+
+: ${netbox_enable:="NO"}
+: ${netbox_user:="netbox"}
+: ${netbox_port:="17000"}
+
+procname=/srv/netbox/venv/bin/python3.11
+pidfile=/var/run/netbox/netbox.pid
+netbox_service="/srv/netbox/service.sh"
+command="/usr/sbin/daemon"
+command_args="-f -t ${name} /usr/bin/env APP_PORT=${netbox_port} PID_FILE=${pidfile} ${netbox_service}"
+
+netbox_precmd()
+{
+ mkdir -p /var/run/netbox
+ chown ${netbox_user} /var/run/netbox
+}
+
+start_precmd=${name}_precmd
+run_rc_command "$1"
diff --git a/roles/netbox/netbox/files/rc/netbox.rc b/roles/netbox/netbox/files/rc/netbox.rc
new file mode 100644
--- /dev/null
+++ b/roles/netbox/netbox/files/rc/netbox.rc
@@ -0,0 +1,17 @@
+# -------------------------------------------------------------
+# NetBox
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/netbox/server/files/rc/netbox.rc
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+netbox_enable="YES"
+netbox_port="{{ app_port }}"
diff --git a/roles/netbox/netbox/files/service.sh b/roles/netbox/netbox/files/service.sh
new file mode 100644
--- /dev/null
+++ b/roles/netbox/netbox/files/service.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+# -------------------------------------------------------------
+# NetBox :: Service starter
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+set -e
+
+SERVICE_ROOT=/srv/netbox
+APP_ROOT=$SERVICE_ROOT/netbox
+
+source $SERVICE_ROOT/venv/bin/activate
+cd $APP_ROOT/netbox
+gunicorn --pid $PID_FILE --pythonpath $APP_ROOT -b "127.0.0.1:$APP_PORT" --config $SERVICE_ROOT/gunicorn.py netbox.wsgi
diff --git a/roles/netbox/netbox/init.sls b/roles/netbox/netbox/init.sls
new file mode 100644
--- /dev/null
+++ b/roles/netbox/netbox/init.sls
@@ -0,0 +1,11 @@
+# -------------------------------------------------------------
+# Netbox
+# -------------------------------------------------------------
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+include:
+ - .software
+ - .config
+ - .service
diff --git a/roles/netbox/netbox/service.sls b/roles/netbox/netbox/service.sls
new file mode 100644
--- /dev/null
+++ b/roles/netbox/netbox/service.sls
@@ -0,0 +1,37 @@
+# -------------------------------------------------------------
+# Netbox
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% from "map.jinja" import services, dirs with context %}
+
+# -------------------------------------------------------------
+# Service wrapper
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+/srv/netbox/service.sh:
+ file.managed:
+ - source: salt://roles/netbox/netbox/files/service.sh
+ - mode: 755
+
+# -------------------------------------------------------------
+# RC service
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{% if services["manager"] == "rc" %}
+
+{{ dirs.etc }}/rc.d/netbox:
+ file.managed:
+ - source: salt://roles/netbox/netbox/files/rc/netbox
+ - mode: 755
+ - template: jinja
+ - context:
+ app_port: {{ pillar["netbox"]["app_port"] }}
+
+/etc/rc.conf.d/netbox:
+ file.managed:
+ - source: salt://roles/netbox/netbox/files/rc/netbox.rc
+
+{% endif %}
diff --git a/roles/netbox/netbox/software.sls b/roles/netbox/netbox/software.sls
new file mode 100644
--- /dev/null
+++ b/roles/netbox/netbox/software.sls
@@ -0,0 +1,96 @@
+# -------------------------------------------------------------
+# Netbox
+# -------------------------------------------------------------
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+# -------------------------------------------------------------
+# NetBox
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+/srv/netbox:
+ file.directory:
+ - mode: 755
+ - makedirs: True
+
+install_netbox:
+ archive.extracted:
+ - name: /srv/netbox/netbox
+ - source: https://github.com/netbox-community/netbox/archive/refs/tags/v3.7.1.tar.gz
+ - source_hash: 97ea9106b6d29e2568c4e9c395013ca015ba7521029e8c907b6aa515dd62649a
+ - enforce_toplevel: False
+ - options: --strip-components=1
+
+# -------------------------------------------------------------
+# User account
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+netbox_group:
+ group.present:
+ - name: netbox
+ - gid: 1001
+
+netbox_user:
+ user.present:
+ - name: netbox
+ - uid: 1001
+ - gid: 1001
+
+# -------------------------------------------------------------
+# Python environment
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+/srv/netbox/venv:
+ file.directory:
+ - user: netbox
+ - group: netbox
+ - mode: 755
+
+netbox_python_venv:
+ cmd.run:
+ - name: |
+ python3 -m venv /srv/netbox/venv
+ . /srv/netbox/venv/bin/activate
+ pip install psycopg-c psycopg-pool psycopg
+ pip install $(grep -v psycopg /srv/netbox/netbox/requirements.txt)
+ - creates: /srv/netbox/venv/pyvenv.cfg
+ - runas: netbox
+
+# -------------------------------------------------------------
+# Documentation
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+/srv/netbox/netbox/netbox/project-static/docs:
+ file.directory:
+ - user: netbox
+ - group: netbox
+ - mode: 755
+
+netbox_build_documentation:
+ cmd.run:
+ - name: |
+ . /srv/netbox/venv/bin/activate
+ mkdocs build
+ - creates: /srv/netbox/netbox/netbox/project-static/docs/assets
+ - runas: netbox
+ - cwd: /srv/netbox/netbox
+
+# -------------------------------------------------------------
+# Static assets
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+/srv/netbox/netbox/netbox/static:
+ file.directory:
+ - user: netbox
+ - group: netbox
+ - mode: 755
+
+netbox_build_static:
+ cmd.run:
+ - name: |
+ . /srv/netbox/venv/bin/activate
+ python3 manage.py collectstatic
+ - creates: /srv/netbox/netbox/netbox/static/netbox.js
+ - runas: netbox
+ - cwd: /srv/netbox/netbox/netbox
diff --git a/top.sls b/top.sls
--- a/top.sls
+++ b/top.sls
@@ -26,6 +26,7 @@
- roles/dbserver-pgsql
- roles/devserver
- roles/grafana
+ - roles/netbox
- roles/prometheus
- roles/redis
- roles/saas-nextcloud

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 09:21 (11 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259145
Default Alt Text
D3469.id8972.diff (24 KB)

Event Timeline