Skip to content

Commit

Permalink
fix NAPALM plugin installation (#23)
Browse files Browse the repository at this point in the history
* resolve issue where napalm was not being written to local_requirements.txt
  • Loading branch information
jvoss authored Apr 4, 2022
1 parent 179fd1f commit c06a67d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
25 changes: 16 additions & 9 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,22 @@ netbox_metrics_enabled: False
# Credentials that Netbox will uses to authenticate to devices when connecting
# via NAPALM.
# Note: Moved to Dynamic Configuration (see netbox_override_dynamic_config)
netbox_napalm:
username: ''
password: ''
timeout: 30 # NAPALM timeout (in seconds). (Default: 30)

# NAPALM optional arguments
# (see https://napalm.readthedocs.io/en/latest/support/#optional-arguments).
# Arguments must be provided as a dictionary.
args: {}
# Define an empty `netbox_napalm` dict in your variables to install the NAPALM
# libraries (when using dynamic configuration)
#
# netbox_napalm:
#
# pre Netbox 3.1:
#
# netbox_napalm:
# username: ''
# password: ''
# timeout: 30 # NAPALM timeout (in seconds). (Default: 30)

# # NAPALM optional arguments
# # (see https://napalm.readthedocs.io/en/latest/support/#optional-arguments).
# # Arguments must be provided as a dictionary.
# args: {}

# Determine how many objects to display per page within a list. (Default: 50)
# Note: Moved to Dynamic Configuration (see netbox_override_dynamic_config)
Expand Down
10 changes: 10 additions & 0 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
mode: '0644'
create: yes

- name: configure | add NAPALM to local_requirements.txt
ansible.builtin.lineinfile:
path: "{{ netbox_current_path }}/local_requirements.txt"
line: "napalm"
regexp: "^napalm"
owner: "{{ netbox_user }}"
mode: '0644'
create: yes
when: netbox_napalm is defined

- name: configure | generate django secret key
ansible.builtin.command: "python3 {{ netbox_current_path }}/netbox/generate_secret_key.py"
register: netbox_secret_key_generated
Expand Down

0 comments on commit c06a67d

Please sign in to comment.