diff --git a/defaults/main.yml b/defaults/main.yml index 6e071fb..c281ae2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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: [] diff --git a/tasks/load_variables.yml b/tasks/load_variables.yml index 7093067..7dc79bc 100644 --- a/tasks/load_variables.yml +++ b/tasks/load_variables.yml @@ -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: diff --git a/tasks/validate_variables.yml b/tasks/validate_variables.yml index 74ca52a..96ccdda 100644 --- a/tasks/validate_variables.yml +++ b/tasks/validate_variables.yml @@ -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: diff --git a/vars/main.yml b/vars/main.yml index c5f41b1..71cf7b2 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -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"