Skip to content

Commit

Permalink
Merge pull request #182 from melonger/develop
Browse files Browse the repository at this point in the history
fix: Adding handling of dictionaries and variable merging
  • Loading branch information
lae authored Sep 12, 2024
2 parents 2858bd2 + 0923cb6 commit e16a346
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 19 deletions.
11 changes: 1 addition & 10 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,7 @@ netbox_metrics_enabled: false
netbox_metrics_dir: netbox_metrics
netbox_metrics_path: "/run/{{ netbox_metrics_dir }}"

netbox_config:
# SECRET_KEY:
ALLOWED_HOSTS:
- localhost
- 127.0.0.1
# NAPALM_USERNAME:
# NAPALM_PASSWORD:
MEDIA_ROOT: "{{ netbox_shared_path }}/media"
REPORTS_ROOT: "{{ netbox_shared_path }}/reports"
SCRIPTS_ROOT: "{{ netbox_shared_path }}/scripts"
netbox_config: {}

netbox_scripts: []
netbox_reports: []
Expand Down
2 changes: 1 addition & 1 deletion tasks/load_variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

- name: Define _netbox_config
set_fact:
_netbox_config: "{{ netbox_config }}"
_netbox_config: "{{ _netbox_default_config | combine(netbox_config, recursive=True) }}"

- name: Generate list of optional Python dependencies
set_fact:
Expand Down
1 change: 1 addition & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
name: "{{ item }}"
state: started
enabled: true
daemon_reload: true
loop:
- netbox.socket
- netbox.service
Expand Down
8 changes: 0 additions & 8 deletions tasks/validate_variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@
msg: "Please define NAPALM_USERNAME and NAPALM_PASSWORD in netbox_config to use NAPALM."
when: "netbox_napalm_enabled | bool"

- name: NetBox user content directories must be specified
assert:
that:
- "'MEDIA_ROOT' in netbox_config"
- "'REPORTS_ROOT' in netbox_config"
- "'SCRIPTS_ROOT' in netbox_config"
msg: "Please ensure MEDIA_ROOT/REPORTS_ROOT/SCRIPTS_ROOT are defined in netbox_config."

- name: Script/Report module names should follow PEP8
assert:
that:
Expand Down
8 changes: 8 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ netbox_config_path: "{{ netbox_current_path }}/netbox/netbox"
netbox_virtualenv_path: "{{ netbox_current_path }}/venv-py3"
netbox_uwsgi_cmd: "{{ netbox_virtualenv_path }}/bin/uwsgi"

_netbox_default_config:
ALLOWED_HOSTS:
- localhost
- 127.0.0.1
MEDIA_ROOT: "{{ netbox_shared_path }}/media"
REPORTS_ROOT: "{{ netbox_shared_path }}/reports"
SCRIPTS_ROOT: "{{ netbox_shared_path }}/scripts"

_netbox_storages_map:
s3boto3: boto3
apache_libcloud: "apache-libcloud"
Expand Down

0 comments on commit e16a346

Please sign in to comment.