Skip to content

Commit 2ce5d70

Browse files
committed
Move LDAP configuration tasks into deploy_netbox.yml and use shared path and a symlink for config
1 parent f588a0c commit 2ce5d70

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

tasks/configure_ldap.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

tasks/deploy_netbox.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,35 @@
2727
notify:
2828
- reload netbox
2929

30-
- include: configure_ldap.yml
31-
when: netbox_ldap_enabled
30+
- block:
31+
- name: Install django-auth-ldap if LDAP is enabled
32+
pip:
33+
name: django-auth-ldap
34+
virtualenv: "{{ netbox_virtualenv_path }}"
35+
36+
- name: Generate LDAP configuration for NetBox if enabled
37+
template:
38+
src: "{{ netbox_ldap_config_template }}"
39+
dest: "{{ netbox_shared_path }}/ldap_config.py"
40+
mode: 0600
41+
notify:
42+
- reload netbox
43+
when:
44+
- netbox_ldap_enabled
3245

3346
- name: Symlink NetBox configuration file into the active NetBox release
3447
file:
3548
src: "{{ netbox_shared_path }}/configuration.py"
3649
dest: "{{ netbox_config_path }}/configuration.py"
3750
state: link
3851

52+
- name: Symlink/Remove NetBox LDAP configuration file into/from the active NetBox release
53+
file:
54+
src: "{{ netbox_shared_path }}/ldap_config.py"
55+
dest: "{{ netbox_config_path }}/ldap_config.py"
56+
force: yes
57+
state: "{{ 'absent' if netbox_ldap_enabled else 'link' }}"
58+
3959
- name: Run database migrations for NetBox
4060
django_manage:
4161
command: migrate

0 commit comments

Comments
 (0)