2021-08-17 16:02:15 +00:00
|
|
|
users = {
|
|
|
|
'netbox': {
|
|
|
|
'home': '/opt/netbox',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
directories = {
|
|
|
|
'/opt/netbox/src': {},
|
|
|
|
'/opt/netbox/media': {
|
|
|
|
'owner': 'netbox',
|
|
|
|
},
|
|
|
|
'/opt/netbox/scripts': {
|
|
|
|
'owner': 'netbox',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
git_deploy = {
|
|
|
|
'/opt/netbox/src': {
|
|
|
|
'repo': 'https://github.com/netbox-community/netbox.git',
|
|
|
|
'rev': node.metadata.get('netbox/version'),
|
|
|
|
'triggers': {
|
|
|
|
'action:netbox_install',
|
|
|
|
'action:netbox_upgrade',
|
|
|
|
'svc_systemd:netbox-web:restart',
|
|
|
|
'svc_systemd:netbox-worker:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
# This is a recreation of https://github.com/netbox-community/netbox/blob/develop/upgrade.sh
|
|
|
|
actions = {
|
|
|
|
'netbox_create_virtualenv': {
|
|
|
|
'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/netbox/venv',
|
|
|
|
'unless': 'test -d /opt/netbox/venv/',
|
|
|
|
'needed_by': {
|
|
|
|
'action:netbox_install',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'netbox_install': {
|
|
|
|
'triggered': True,
|
|
|
|
'command': ' && '.join([
|
|
|
|
'cd /opt/netbox/src',
|
|
|
|
'/opt/netbox/venv/bin/pip install --upgrade pip wheel setuptools django-auth-ldap gunicorn',
|
|
|
|
'/opt/netbox/venv/bin/pip install --upgrade -r requirements.txt',
|
|
|
|
]),
|
|
|
|
'needs': {
|
|
|
|
'pkg_apt:build-essential',
|
|
|
|
'pkg_apt:graphviz',
|
|
|
|
'pkg_apt:libffi-dev',
|
|
|
|
'pkg_apt:libldap2-dev',
|
|
|
|
'pkg_apt:libpq-dev',
|
|
|
|
'pkg_apt:libsasl2-dev',
|
|
|
|
'pkg_apt:libssl-dev',
|
|
|
|
'pkg_apt:libxml2-dev',
|
|
|
|
'pkg_apt:libxslt1-dev',
|
|
|
|
'pkg_apt:python3-dev',
|
|
|
|
'pkg_apt:zlib1g-dev',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'netbox_upgrade': {
|
|
|
|
'triggered': True,
|
|
|
|
'command': ' && '.join([
|
|
|
|
'/opt/netbox/venv/bin/python /opt/netbox/src/netbox/manage.py migrate',
|
|
|
|
'/opt/netbox/venv/bin/python /opt/netbox/src/netbox/manage.py collectstatic --no-input',
|
|
|
|
'/opt/netbox/venv/bin/python /opt/netbox/src/netbox/manage.py remove_stale_contenttypes --no-input',
|
2021-09-22 14:43:59 +00:00
|
|
|
'/opt/netbox/venv/bin/python /opt/netbox/src/netbox/manage.py clearsessions',
|
2021-08-17 16:02:15 +00:00
|
|
|
]),
|
|
|
|
'needs': {
|
|
|
|
'action:netbox_install',
|
|
|
|
'file:/opt/netbox/src/netbox/netbox/configuration.py',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
files = {
|
2023-08-02 06:07:36 +00:00
|
|
|
'/usr/local/lib/systemd/system/netbox-web.service': {
|
2021-08-17 16:02:15 +00:00
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
'svc_systemd:netbox-web:restart',
|
|
|
|
},
|
|
|
|
},
|
2023-08-02 06:07:36 +00:00
|
|
|
'/usr/local/lib/systemd/system/netbox-worker.service': {
|
2021-08-17 16:02:15 +00:00
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
'svc_systemd:netbox-worker:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'/opt/netbox/src/netbox/netbox/configuration.py': {
|
|
|
|
'content_type': 'mako',
|
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:netbox-web:restart',
|
|
|
|
'svc_systemd:netbox-worker:restart',
|
|
|
|
},
|
|
|
|
'needs': {
|
|
|
|
'git_deploy:/opt/netbox/src',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'/opt/netbox/gunicorn_config.py': {
|
|
|
|
'content_type': 'mako',
|
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:netbox-web:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
svc_systemd = {
|
|
|
|
'netbox-web': {
|
|
|
|
'needs': {
|
|
|
|
'action:netbox_install',
|
|
|
|
'action:netbox_upgrade',
|
2023-08-02 06:07:36 +00:00
|
|
|
'file:/usr/local/lib/systemd/system/netbox-web.service',
|
2021-08-17 16:02:15 +00:00
|
|
|
'file:/opt/netbox/gunicorn_config.py',
|
|
|
|
'file:/opt/netbox/src/netbox/netbox/configuration.py',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'netbox-worker': {
|
|
|
|
'needs': {
|
|
|
|
'action:netbox_install',
|
|
|
|
'action:netbox_upgrade',
|
2023-08-02 06:07:36 +00:00
|
|
|
'file:/usr/local/lib/systemd/system/netbox-worker.service',
|
2021-08-17 16:02:15 +00:00
|
|
|
'file:/opt/netbox/src/netbox/netbox/configuration.py',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|