The NetBox plugin exposes 2 inventory classes for usage.
NBInventory
is deprecated and should not be used anymore, it is still available for backwards compatibility onlyNetBoxInventory2
is the recommended NetBox inventory plugin. It provides some extra functionality such as exposing all NetBox device attributes to the Nonir Host through the data attribute. It is the recommended plugin to use. All feature development will only take place on this plugin.
The recommended way to install nornir_netbox is via pip or poetry.
pip install nornir-netbox
poetry add nornir-netbox
---
inventory:
plugin: NBInventory
options:
nb_url: "https://netbox.local"
nb_token: "123_NETBOX_API_TOKEN_456"
---
inventory:
plugin: NetBoxInventory2
options:
nb_url: "https://netbox.local"
nb_token: "123_NETBOX_API_TOKEN_456"
from nornir import InitNornir
nr = InitNornir(
inventory={
"plugin":"NBInventory",
"options": {
"nb_url": "https://netbox.local",
"nb_token": "123_NETBOX_API_TOKEN_456"
}
}
)
from nornir import InitNornir
nr = InitNornir(
inventory={
"plugin":"NetBoxInventory2",
"options": {
"nb_url": "https://netbox.local",
"nb_token": "123_NETBOX_API_TOKEN_456"
}
}
)