Initial commit
This commit is contained in:
commit
279b26964a
5 changed files with 68 additions and 0 deletions
12
defaults/main.yml
Normal file
12
defaults/main.yml
Normal 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
2
handlers/main.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
- name: reconfigure netbox
|
||||
ansible.builtin.command: dpkg-reconfigure netbox
|
||||
44
tasks/main.yml
Normal file
44
tasks/main.yml
Normal 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)
|
||||
5
templates/configuration.py.j2
Normal file
5
templates/configuration.py.j2
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{% for key, value in netbox_config.items() %}
|
||||
{{ key }} = {{ value.__repr__() }}
|
||||
{% endfor %}
|
||||
|
||||
{{ netbox_config_raw }}
|
||||
5
templates/gunicorn.conf.py.j2
Normal file
5
templates/gunicorn.conf.py.j2
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{% for key, value in netbox_gunicorn_config.items() %}
|
||||
{{ key }} = {{ value.__repr__() }}
|
||||
{% endfor %}
|
||||
|
||||
{{ netbox_gunicorn_config_raw }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue