Skip to content

Commit 3be9458

Browse files
committed
Make netbox_local_settings_file optional and include explanation
1 parent 282202a commit 3be9458

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

README.adoc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -401,16 +401,16 @@ role. If this is undesirable, consider toggling `netbox_superuser_enabled`.
401401

402402
[source,yaml]
403403
----
404-
netbox_local_settings_file: netbox_local_settings.py
404+
# netbox_local_settings_file: "{{ playbook_dir }}/files/netbox/local_settings.py"
405405
----
406406

407-
Add the `netbox_local_settings_file` var with the name of the local settings
408-
file in your ansible repository to deploy local_settings.py to NetBox.
409-
Ansible will search your playbook's `files/` directory for this when using a
410-
relative path.
407+
If you need to override any settings or extend the functionality in NetBox' `settings.py`
408+
in a way that is not supported by the `configuration.py` (i.e. the `netbox_config` role variable),
409+
you can set `netbox_local_settings_file` to a local file path in your playbook to deploy a `local_settings.py` file within NetBox.
410+
This feature was https://github.com/netbox-community/netbox/issues/16127[introduced in NetBox v4.0.2].
411+
You may need to use this file for deploying certain NetBox plugins.
411412

412-
NOTE: The destination file will always be `local_settings.py`, the source file name
413-
can be unique to allow for different deployments from the one ansible repository.
413+
NOTE: Commenting or removing this role variable from your playbook will remove `local_settings.py` from your NetBox deployment.
414414

415415
[source,yaml]
416416
----

defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ netbox_requests_log: "file:{{ netbox_shared_path }}/requests.log"
7474
netbox_ldap_enabled: false
7575
netbox_ldap_config_template: netbox_ldap_config.py.j2
7676

77-
netbox_local_settings_file:
77+
# netbox_local_settings_file: "{{ playbook_dir }}/files/netbox/local_settings.py"
7878

7979
netbox_napalm_enabled: false
8080
netbox_napalm_packages:

tasks/deploy_netbox.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,14 @@
140140
dest: "{{ netbox_shared_path }}/local_settings.py"
141141
owner: "{{ netbox_user }}"
142142
group: "{{ netbox_group }}"
143-
ignore_errors: yes
144143
when:
145144
- netbox_local_settings_file is defined
146145
notify:
147146
- reload netbox.service
148147

149148
- name: Symlink/Remove NetBox local_settings.py file into/from the active NetBox release
150-
file:
151-
src: "{{ netbox_shared_path + '/local_settings.py' if netbox_local_settings_file is defined else omit }}"
149+
ansible.builtin.file:
150+
src: "{{ netbox_shared_path }}/local_settings.py"
152151
dest: "{{ netbox_config_path }}/local_settings.py"
153152
owner: "{{ netbox_user }}"
154153
group: "{{ netbox_group }}"

0 commit comments

Comments
 (0)