--- {%- from "netbox/map.jinja" import netbox with context %} netbox_pkg_reqs: pkg.installed: - pkgs: {%- for pkg in netbox.pkgs %} - {{ pkg }} {%- endfor %} netbox-virtualenv-pkg: pip.installed: - name: virtualenv - bin_env: /usr/local/bin/pip3 netbox-archive-extract: archive.extracted: - name: {{ netbox.release_dir }} - source: {{ netbox.archive_url }}/v{{ netbox.version }}.tar.gz - skip_verify: true 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/.venv - 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/.venv/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 - watch_in: - service: netbox-service 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 - watch_in: - service: netbox-service netbox-migration: module.run: - name: django.migrate - settings_module: netbox.settings - pythonpath: {{ netbox.install_dir }}/netbox/netbox - bin_env: {{ netbox.install_dir }}/netbox/.venv/bin/django-admin - require: - virtualenv: netbox-virtualenv netbox-install-static-files: module.run: - name: django.collectstatic - settings_module: netbox.settings - pythonpath: {{ netbox.install_dir }}/netbox/netbox - bin_env: {{ netbox.install_dir }}/netbox/.venv/bin/django-admin - require: - virtualenv: netbox-virtualenv netbox-cleanup: software.cleanup: - name: netbox - path: {{ netbox.release_dir }} - version: "{{ netbox.version }}"