paulbsd-salt/states/netbox/install.sls

93 lines
2.4 KiB
Plaintext
Raw Normal View History

2020-07-10 00:58:55 +02:00
---
{%- from "netbox/map.jinja" import netbox with context %}
2023-01-04 23:33:52 +01:00
netbox-pkg-reqs:
2022-12-26 10:12:45 +01:00
pkg.installed:
- pkgs:
{%- for pkg in netbox.pkgs %}
- {{ pkg }}
{%- endfor %}
2020-07-10 00:58:55 +02:00
netbox-virtualenv-pkg:
pip.installed:
- name: virtualenv
2022-10-01 20:11:59 +02:00
- bin_env: /usr/local/bin/pip3
2020-07-10 00:58:55 +02:00
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 }}
- force: true
2020-07-10 00:58:55 +02:00
- watch_in:
- service: netbox-service
- require:
- archive: netbox-archive-extract
netbox-virtualenv:
virtualenv.managed:
2022-06-08 23:49:12 +02:00
- name: {{ netbox.install_dir }}/netbox/.venv
2020-07-10 00:58:55 +02:00
- requirements: {{ netbox.install_dir }}/netbox/requirements.txt
- python: /usr/bin/python3
- require:
- pip: netbox-virtualenv-pkg
netbox-gunicorn-pkg:
pip.installed:
- name: gunicorn
2022-06-08 23:49:12 +02:00
- bin_env: {{ netbox.install_dir }}/netbox/.venv/bin/pip3
2020-07-10 00:58:55 +02:00
- 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
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
- 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-06-08 23:49:12 +02:00
- bin_env: {{ netbox.install_dir }}/netbox/.venv/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-06-08 23:49:12 +02:00
- bin_env: {{ netbox.install_dir }}/netbox/.venv/bin/django-admin
2020-07-10 00:58:55 +02:00
- require:
2021-08-19 21:15:24 +02:00
- virtualenv: netbox-virtualenv
netbox-cleanup:
software.cleanup:
- name: netbox
- path: {{ netbox.release_dir }}
- version: "{{ netbox.version }}"
- require:
- file: netbox-install-link