Skip to content

Commit 4001903

Browse files
committed
Merge branch 'feature/napalm' into master
2 parents 28b8f66 + 0ab8616 commit 4001903

File tree

5 files changed

+18
-1
lines changed

5 files changed

+18
-1
lines changed

defaults/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ netbox_config:
2626
ALLOWED_HOSTS:
2727
- localhost
2828
- 127.0.0.1
29+
#NETBOX_USERNAME:
30+
#NETBOX_PASSWORD:
2931

3032
netbox_user: netbox
3133
netbox_group: netbox
@@ -48,3 +50,5 @@ netbox_load_initial_data: false
4850

4951
netbox_ldap_enabled: false
5052
netbox_ldap_config_template: netbox_ldap_config.py.j2
53+
54+
netbox_napalm_enabled: false

examples/netbox_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ netbox_config:
3131
MAX_PAGE_SIZE: 500
3232
PAGINATE_COUNT: 100
3333
PREFER_IPV4: False
34+
NETBOX_USERNAME: netbox
35+
NETBOX_PASSWORD: NetBox42
3436
TIME_ZONE: UTC
3537
DATE_FORMAT: N j, Y
3638
# quotes aren't necessary as you can see - but in my opinion quotes make this more readable

tasks/deploy_netbox.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@
4444
when:
4545
- netbox_ldap_enabled
4646

47+
- name: Install napalm if NAPALM integration is enabled
48+
pip:
49+
name: napalm
50+
virtualenv: "{{ netbox_virtualenv_path }}"
51+
4752
- name: Symlink NetBox configuration file into the active NetBox release
4853
file:
4954
src: "{{ netbox_shared_path }}/configuration.py"

tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
# tasks file for lae.netbox
3-
- include: check_mandatory_vars.yml
3+
- include: validate_variables.yml
44

55
- name: Gather OS specific variables
66
include_vars: "{{ item }}"

tasks/check_mandatory_vars.yml renamed to tasks/validate_variables.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@
3030
msg: "Please set netbox_python to either 2 or 3."
3131
when:
3232
- netbox_python not in [2, 3]
33+
34+
- name: Ensure NETBOX_USERNAME/PASSWORD is defined for NAPALM integration
35+
fail:
36+
msg: "Please define NETBOX_USERNAME and NETBOX_PASSWORD in netbox_config to use NAPALM."
37+
when:
38+
- netbox_napalm_enabled and ("NETBOX_USERNAME" not in netbox_config or "NETBOX_PASSWORD" not in netbox_config)

0 commit comments

Comments
 (0)