Skip to content

Commit 06fc8e4

Browse files
committed
deploy local settings to shared and symlink
1 parent b7e4945 commit 06fc8e4

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tasks/deploy_netbox.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,30 @@
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+
copy:
139+
src: "{{ playbook_dir }}/files/netbox/local_settings.py"
140+
dest: "{{ netbox_shared_path }}/local_settings.py"
141+
owner: "{{ netbox_user }}"
142+
group: "{{ netbox_group }}"
143+
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
149+
150+
- name: Symlink/Remove NetBox local_settings.py file into/from the active NetBox release
151+
file:
152+
src: "{{ netbox_shared_path + '/local_settings.py' if netbox_local_settings_file_in_shared.stat.exists else omit }}"
153+
dest: "{{ netbox_config_path }}/local_settings.py"
154+
owner: "{{ netbox_user }}"
155+
group: "{{ netbox_group }}"
156+
state: "{{ 'link' if netbox_local_settings_file_in_shared.stat.exists else 'absent' }}"
157+
notify:
158+
- reload netbox.service
159+
136160
- name: Copy NetBox scripts into SCRIPTS_ROOT
137161
copy:
138162
src: "{{ item.src }}"

0 commit comments

Comments
 (0)