wvandeun/nornir_netbox

Optional arguments

dclew opened this issue · 1 comments

dclew commented

Is there a way to pass optional arguments to the inventory? Maybe I'm missing something. When I use SimpleInventory in Nornir, I'm able to pass optional arguments for each host in the host file such:

HOSTNAME:
  hostname: 1.1.1.1
  platform: 'ios'
  username: -
  password: -
  connection_options:
    netmiko:
      extras:
        device_type: 'cisco_ios'
        global_delay_factor: 2
    napalm:
      extras:
        optional_args:
          global_delay_factor: 2

How do you pass global_delay_factor and other optional arguments into Nornir using this inventory plugin?

At this stage you are not able to do this directly from the plugin.

But you can still set them directly in your script. Please refer to the Nornir documentation for that. An example could be:

nr.inventory.defaults.connection_options["napalm"] = ConnectionOptions(extras={"optional_args": {"secret":password}})

There is a PR in progress #14 that will allow you to use simpleinventory plugin group files and defaults file with NetBox. That will also solve the issue when ready.