2020-07-10 00:58:55 +02:00
|
|
|
---
|
|
|
|
{%- from "netbox/map.jinja" import netbox with context %}
|
|
|
|
netbox-virtualenv-pkg:
|
|
|
|
pip.installed:
|
|
|
|
- name: virtualenv
|
|
|
|
- bin_env: /usr/bin/pip3
|
|
|
|
|
|
|
|
netbox-archive-extract:
|
|
|
|
archive.extracted:
|
|
|
|
- name: {{ netbox.release_dir }}
|
|
|
|
- source: {{ netbox.archive_url }}/v{{ netbox.version }}.tar.gz
|
2020-09-12 17:41:35 +02:00
|
|
|
- skip_verify: true
|
2020-07-10 00:58:55 +02:00
|
|
|
|
|
|
|
netbox-install-link:
|
|
|
|
file.symlink:
|
|
|
|
- name: {{ netbox.install_dir }}/netbox
|
|
|
|
- target: {{ netbox.release_dir }}/netbox-{{ netbox.version }}
|
|
|
|
- watch_in:
|
|
|
|
- service: netbox-service
|
|
|
|
- require:
|
|
|
|
- archive: netbox-archive-extract
|
|
|
|
|
|
|
|
netbox-virtualenv:
|
|
|
|
virtualenv.managed:
|
|
|
|
- name: {{ netbox.install_dir }}/netbox
|
|
|
|
- requirements: {{ netbox.install_dir }}/netbox/requirements.txt
|
|
|
|
- python: /usr/bin/python3
|
|
|
|
- require:
|
|
|
|
- pip: netbox-virtualenv-pkg
|
|
|
|
|
|
|
|
netbox-gunicorn-pkg:
|
|
|
|
pip.installed:
|
|
|
|
- name: gunicorn
|
|
|
|
- bin_env: {{ netbox.install_dir }}/netbox/bin/pip3
|
|
|
|
- require:
|
|
|
|
- virtualenv: netbox-virtualenv
|
|
|
|
|
|
|
|
netbox-gunicorn-execfile:
|
|
|
|
file.managed:
|
|
|
|
- name: {{ netbox.install_dir }}/netbox/gunicorn.py
|
|
|
|
- source: salt://netbox/templates/gunicorn.py.j2
|
|
|
|
- user: root
|
|
|
|
- group: root
|
|
|
|
- mode: 0644
|
|
|
|
- template: jinja
|
2022-02-21 13:52:46 +01:00
|
|
|
- watch_in:
|
|
|
|
- service: netbox-service
|
2020-07-10 00:58:55 +02:00
|
|
|
|
|
|
|
netbox-config-file:
|
|
|
|
file.managed:
|
|
|
|
- name: {{ netbox.install_dir }}/netbox/netbox/netbox/configuration.py
|
|
|
|
- source: salt://netbox/templates/configuration.py.j2
|
|
|
|
- user: root
|
|
|
|
- group: root
|
|
|
|
- mode: 0644
|
|
|
|
- template: jinja
|
2022-02-21 13:52:46 +01:00
|
|
|
- watch_in:
|
|
|
|
- service: netbox-service
|
2020-07-10 00:58:55 +02:00
|
|
|
|
|
|
|
netbox-migration:
|
|
|
|
module.run:
|
|
|
|
- name: django.migrate
|
|
|
|
- settings_module: netbox.settings
|
|
|
|
- pythonpath: {{ netbox.install_dir }}/netbox/netbox
|
2022-04-17 20:28:17 +02:00
|
|
|
- bin_env: {{ netbox.install_dir }}/netbox/bin/django-admin
|
2020-07-10 00:58:55 +02:00
|
|
|
- require:
|
|
|
|
- virtualenv: netbox-virtualenv
|
|
|
|
|
|
|
|
netbox-install-static-files:
|
|
|
|
module.run:
|
|
|
|
- name: django.collectstatic
|
|
|
|
- settings_module: netbox.settings
|
|
|
|
- pythonpath: {{ netbox.install_dir }}/netbox/netbox
|
2022-04-17 20:28:17 +02:00
|
|
|
- bin_env: {{ netbox.install_dir }}/netbox/bin/django-admin
|
2020-07-10 00:58:55 +02:00
|
|
|
- require:
|
2021-08-19 21:15:24 +02:00
|
|
|
- virtualenv: netbox-virtualenv
|
2022-02-21 13:52:46 +01:00
|
|
|
|
|
|
|
netbox-cleanup:
|
|
|
|
software.cleanup:
|
|
|
|
- name: netbox
|
|
|
|
- path: {{ netbox.release_dir }}
|
|
|
|
- version: "{{ netbox.version }}"
|