Skip to content

Commit

Permalink
deploy local settings to shared and symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
sol1-matt committed Nov 26, 2024
1 parent b7e4945 commit 06fc8e4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tasks/deploy_netbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,30 @@
notify:
- reload netbox.service

# local_settings.py
- name: Copy NetBox local_settings.py into shared (ignore if it doesn't exist)
copy:
src: "{{ playbook_dir }}/files/netbox/local_settings.py"
dest: "{{ netbox_shared_path }}/local_settings.py"
owner: "{{ netbox_user }}"
group: "{{ netbox_group }}"
ignore_errors: yes

- name: Check if local_settings.py file exists in shared
stat:
path: "{{ netbox_shared_path }}/local_settings.py"
register: netbox_local_settings_file_in_shared

- name: Symlink/Remove NetBox local_settings.py file into/from the active NetBox release
file:
src: "{{ netbox_shared_path + '/local_settings.py' if netbox_local_settings_file_in_shared.stat.exists else omit }}"
dest: "{{ netbox_config_path }}/local_settings.py"
owner: "{{ netbox_user }}"
group: "{{ netbox_group }}"
state: "{{ 'link' if netbox_local_settings_file_in_shared.stat.exists else 'absent' }}"
notify:
- reload netbox.service

- name: Copy NetBox scripts into SCRIPTS_ROOT
copy:
src: "{{ item.src }}"
Expand Down

0 comments on commit 06fc8e4

Please sign in to comment.