IPFabric Inventory plugin for nornir.
The recommended way to install nornir_ipfabric is via pip
pip install nornir-ipfabric
An instance of IP Fabric is required to collect information. Request trial license.
Set environment vars to provide url and credentials to connect to the IP Fabric server
export IPF_URL=https://ipfabric.local
export IPF_USER=admin
export IPF_PASSWORD=mySecretPassword
If IP Fabric version 3.7 or above is in use, token authentication is available
export IPF_URL=https://ipfabric.local
export IPF_TOKEN=myToken
from nornir import InitNornir
nr = InitNornir(inventory={"plugin": "IPFabricInventory"})
Init with credentials
from nornir import InitNornir
nr = InitNornir(
inventory=
{
"plugin": "IPFabricInventory",
"options": {
"ipf_url":"https://ipfabric.local",
"ipf_user":"admin",
"ipf_password":"mySecretPassword",
},
},
)
Init with token
from nornir import InitNornir
nr = InitNornir(
inventory=
{
"plugin": "IPFabricInventory",
"options": {
"ipf_url":"https://ipfabric.local",
"ipf_token":"myToken",
},
},
)
File config.yaml with credendials
---
inventory:
plugin: IPFInventory
options:
ipf_url: "https://ipfabric.local"
ipf_user: "admin"
ipf_password: "mySecretPassword"
File config.yaml with token
---
inventory:
plugin: IPFInventory
options:
ipf_url: "https://ipfabric.local"
ipf_token: "myToken"
Usage:
from nornir import InitNornir
nr = InitNornir(config_file="config.yaml",inventory={"plugin": "IPFabricInventory"})