Initial commit

This commit is contained in:
Julian Rother 2025-01-09 23:44:03 +01:00
commit 279b26964a
Signed by: julian
GPG key ID: C19B924C0CD13341
5 changed files with 68 additions and 0 deletions

12
defaults/main.yml Normal file
View file

@ -0,0 +1,12 @@
netbox_config:
# DATABASE: {...}
# REDIS: {...}
# SECRET_KEY: "..."
MEDIA_ROOT: /var/lib/netbox/media
REPORTS_ROOT: /var/lib/netbox/reports
SCRIPTS_ROOT: /var/lib/netbox/scripts
CENSUS_REPORTING_ENABLED: false
netbox_config_raw: ''
netbox_gunicorn_config: {}
netbox_gunicorn_config_raw: ''

2
handlers/main.yml Normal file
View file

@ -0,0 +1,2 @@
- name: reconfigure netbox
ansible.builtin.command: dpkg-reconfigure netbox

44
tasks/main.yml Normal file
View file

@ -0,0 +1,44 @@
- name: Create netbox group
ansible.builtin.group:
name: netbox
system: true
- name: Create netbox user
ansible.builtin.user:
name: netbox
group: netbox
groups:
- redis
home: /var/lib/netbox
create_home: false # Created by postinst
system: true
- name: Create netbox config dir
ansible.builtin.file:
path: /etc/netbox
owner: root
group: netbox
mode: 0750
state: directory
- name: Create netbox config
ansible.builtin.template:
src: configuration.py.j2
dest: /etc/netbox/configuration.py
owner: root
group: netbox
mode: '0640'
notify:
- reconfigure netbox
- name: Create gunicorn config
ansible.builtin.template:
src: gunicorn.conf.py.j2
dest: /etc/netbox/gunicorn.conf.py
owner: root
group: netbox
mode: '0640'
notify:
- reconfigure netbox
# TODO: Build, fetch and install the deb (currently borrowed from KuKo and manually installed)

View file

@ -0,0 +1,5 @@
{% for key, value in netbox_config.items() %}
{{ key }} = {{ value.__repr__() }}
{% endfor %}
{{ netbox_config_raw }}

View file

@ -0,0 +1,5 @@
{% for key, value in netbox_gunicorn_config.items() %}
{{ key }} = {{ value.__repr__() }}
{% endfor %}
{{ netbox_gunicorn_config_raw }}