File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed
Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -399,6 +399,19 @@ You can find an example in `examples/`. You will also need to set
399399TIP: By default, a local (non-LDAP) superuser will still be created by this
400400role. If this is undesirable, consider toggling `netbox_superuser_enabled`.
401401
402+ [source,yaml]
403+ ----
404+ # netbox_local_settings_file: "{{ playbook_dir }}/files/netbox/local_settings.py"
405+ ----
406+
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.
412+
413+ NOTE: Commenting or removing this role variable from your playbook will remove `local_settings.py` from your NetBox deployment.
414+
402415[source,yaml]
403416----
404417netbox_napalm_enabled: false
Original file line number Diff line number Diff line change @@ -74,6 +74,8 @@ netbox_requests_log: "file:{{ netbox_shared_path }}/requests.log"
7474netbox_ldap_enabled : false
7575netbox_ldap_config_template : netbox_ldap_config.py.j2
7676
77+ # netbox_local_settings_file: "{{ playbook_dir }}/files/netbox/local_settings.py"
78+
7779netbox_napalm_enabled : false
7880netbox_napalm_packages :
7981 - napalm
Original file line number Diff line number Diff line change 133133 notify :
134134 - reload netbox.service
135135
136+ # local_settings.py
137+ - name : Copy NetBox local_settings.py into shared (ignore if it doesn't exist)
138+ ansible.builtin.copy :
139+ src : " {{ netbox_local_settings_file }}"
140+ dest : " {{ netbox_shared_path }}/local_settings.py"
141+ owner : " {{ netbox_user }}"
142+ group : " {{ netbox_group }}"
143+ when :
144+ - netbox_local_settings_file is defined
145+ notify :
146+ - reload netbox.service
147+
148+ - name : Symlink/Remove NetBox local_settings.py file into/from the active NetBox release
149+ ansible.builtin.file :
150+ src : " {{ netbox_shared_path }}/local_settings.py"
151+ dest : " {{ netbox_config_path }}/local_settings.py"
152+ owner : " {{ netbox_user }}"
153+ group : " {{ netbox_group }}"
154+ state : " {{ 'link' if netbox_local_settings_file is defined else 'absent' }}"
155+ notify :
156+ - reload netbox.service
157+
136158- name : Copy NetBox scripts into SCRIPTS_ROOT
137159 copy :
138160 src : " {{ item.src }}"
You can’t perform that action at this time.
0 commit comments