File tree Expand file tree Collapse file tree 3 files changed +24
-9
lines changed
Expand file tree Collapse file tree 3 files changed +24
-9
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_enabled: false
405+ netbox_local_settings_config_file: local_setting.py
406+ ----
407+
408+ Toggle `netbox_local_settings_enabled` to `true` to deploy local_settings.py for
409+ NetBox. `netbox_local_settings_config_file` should be the path to your file - by
410+ default, Ansible will search your playbook's `files/` directory for this.
411+
412+ NOTE: The destination file will always be `local_settings.py`, the source file name
413+ can be unique.
414+
402415[source,yaml]
403416----
404417netbox_napalm_enabled: false
Original file line number Diff line number Diff line change @@ -74,6 +74,9 @@ 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_enabled : false
78+ netbox_local_settings_config_file : " netbox_local_settings.py"
79+
7780netbox_napalm_enabled : false
7881netbox_napalm_packages :
7982 - napalm
Original file line number Diff line number Diff line change 135135
136136# local_settings.py
137137- name : Copy NetBox local_settings.py into shared (ignore if it doesn't exist)
138- copy :
139- src : " {{ playbook_dir }}/files/netbox/local_settings.py "
138+ ansible.builtin. copy :
139+ src : " {{ netbox_local_settings_config_file }}"
140140 dest : " {{ netbox_shared_path }}/local_settings.py"
141141 owner : " {{ netbox_user }}"
142142 group : " {{ netbox_group }}"
143143 ignore_errors : yes
144-
145- - name : Check if local_settings.py file exists in shared
146- stat :
147- path : " {{ netbox_shared_path }}/local_settings.py"
148- register : netbox_local_settings_file_in_shared
144+ when :
145+ - netbox_local_settings_enabled
146+ notify :
147+ - reload netbox.service
149148
150149- name : Symlink/Remove NetBox local_settings.py file into/from the active NetBox release
151150 file :
152- src : " {{ netbox_shared_path + '/local_settings.py' if netbox_local_settings_file_in_shared.stat.exists else omit }}"
151+ src : " {{ netbox_shared_path + '/local_settings.py' if netbox_local_settings_enabled else omit }}"
153152 dest : " {{ netbox_config_path }}/local_settings.py"
154153 owner : " {{ netbox_user }}"
155154 group : " {{ netbox_group }}"
156- state : " {{ 'link' if netbox_local_settings_file_in_shared.stat.exists else 'absent' }}"
155+ state : " {{ 'link' if netbox_local_settings_enabled else 'absent' }}"
157156 notify :
158157 - reload netbox.service
159158
You can’t perform that action at this time.
0 commit comments