Nornir3 + Netbox + Netmiko; how to use them? #671
Unanswered
zubovsergey
asked this question in
Q&A
Replies: 1 comment
-
Use Nornir's transform function and set the password or alternatively loop over the hosts and set the password/secret as needed. This gets a bit harder for the secret as you need the exact proper format for |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I was able to connect to Netbox using Nornir plugin and gather information about cisco devices.
So now I want to run some commands (via Netmiko), but I can't understand how to provide credentials for this (they are not in Netbox secret, so I need to add them in the script somehow). Could someone advice how to handle this?
example:
from nornir import InitNornir
from nornir_netmiko.tasks import netmiko_send_command, netmiko_send_config
from nornir_utils.plugins.functions import print_result
nr = InitNornir(
inventory={
"plugin":"NetBoxInventory2",
"options": {
"nb_url": "netbox link",
"nb_token": "token",
"filter_parameters": {
"site": "vx",
"role": "access-switch"
}
}
}
)
In [19]: nr.inventory.hosts
Out[19]:
{'vx-access-1a': Host: vx-access-1a,
'vx-access-1b': Host: vx-access-1b,
'vx-access-2a': Host: vx-access-2a,
'vx-access-2b': Host: vx-access-2b,
'vx-dev-access-bf1a': Host: vx-dev-access-bf1a,
'vx-dev-access-bf1b': Host: vx-dev-access-bf1b,
'vx-dev-access-bf2a': Host: vx-dev-access-bf2a,
'vx-dev-access-bf2b': Host: vx-dev-access-bf2b,
'vx-lab-access-1a': Host: vx-lab-access-1a,
'vx-lab-access-1b': Host: vx-lab-access-1b,
'vx-mgmt-access-1a': Host: vx-mgmt-access-1a,
'vx-mgmt-access-1b': Host: vx-mgmt-access-1b}
Beta Was this translation helpful? Give feedback.
All reactions