Skip to content

Commit e16a346

Browse files
authored
Merge pull request #182 from melonger/develop
fix: Adding handling of dictionaries and variable merging
2 parents 2858bd2 + 0923cb6 commit e16a346

File tree

5 files changed

+11
-19
lines changed

5 files changed

+11
-19
lines changed

defaults/main.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,7 @@ netbox_metrics_enabled: false
5050
netbox_metrics_dir: netbox_metrics
5151
netbox_metrics_path: "/run/{{ netbox_metrics_dir }}"
5252

53-
netbox_config:
54-
# SECRET_KEY:
55-
ALLOWED_HOSTS:
56-
- localhost
57-
- 127.0.0.1
58-
# NAPALM_USERNAME:
59-
# NAPALM_PASSWORD:
60-
MEDIA_ROOT: "{{ netbox_shared_path }}/media"
61-
REPORTS_ROOT: "{{ netbox_shared_path }}/reports"
62-
SCRIPTS_ROOT: "{{ netbox_shared_path }}/scripts"
53+
netbox_config: {}
6354

6455
netbox_scripts: []
6556
netbox_reports: []

tasks/load_variables.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
- name: Define _netbox_config
3131
set_fact:
32-
_netbox_config: "{{ netbox_config }}"
32+
_netbox_config: "{{ _netbox_default_config | combine(netbox_config, recursive=True) }}"
3333

3434
- name: Generate list of optional Python dependencies
3535
set_fact:

tasks/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
name: "{{ item }}"
117117
state: started
118118
enabled: true
119+
daemon_reload: true
119120
loop:
120121
- netbox.socket
121122
- netbox.service

tasks/validate_variables.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@
4242
msg: "Please define NAPALM_USERNAME and NAPALM_PASSWORD in netbox_config to use NAPALM."
4343
when: "netbox_napalm_enabled | bool"
4444

45-
- name: NetBox user content directories must be specified
46-
assert:
47-
that:
48-
- "'MEDIA_ROOT' in netbox_config"
49-
- "'REPORTS_ROOT' in netbox_config"
50-
- "'SCRIPTS_ROOT' in netbox_config"
51-
msg: "Please ensure MEDIA_ROOT/REPORTS_ROOT/SCRIPTS_ROOT are defined in netbox_config."
52-
5345
- name: Script/Report module names should follow PEP8
5446
assert:
5547
that:

vars/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ netbox_config_path: "{{ netbox_current_path }}/netbox/netbox"
44
netbox_virtualenv_path: "{{ netbox_current_path }}/venv-py3"
55
netbox_uwsgi_cmd: "{{ netbox_virtualenv_path }}/bin/uwsgi"
66

7+
_netbox_default_config:
8+
ALLOWED_HOSTS:
9+
- localhost
10+
- 127.0.0.1
11+
MEDIA_ROOT: "{{ netbox_shared_path }}/media"
12+
REPORTS_ROOT: "{{ netbox_shared_path }}/reports"
13+
SCRIPTS_ROOT: "{{ netbox_shared_path }}/scripts"
14+
715
_netbox_storages_map:
816
s3boto3: boto3
917
apache_libcloud: "apache-libcloud"

0 commit comments

Comments
 (0)