Is it possible to pass nornir inventory/groups as variables?

I’m trying to build a tool for my organization’s 1st level network support that uses nornir. My goal is for them to be able to enter in a customer’s service ID (which will then pull a list of relevant network devices from our database) and then run some commands against these network devices with nornir.

The problem for me is that it appears like nornir always needs the physical existence of the groups.yml and hosts.yml files.

I can programatically init nornir as follows without a config file:
nr = InitNornir(
“plugin”: “threaded”,
“options”: {
“num_workers”: 100,
“plugin”: “SimpleInventory”,
“options”: {
“host_file”: “temp_hosts.yml”,
“group_file”: “temp_groups.yml”

Is it possible for me to do something similar for the hosts and groups yml files? It would be really helpful if that was possible.

At the moment I am having to create temp hosts and group yml files just so nornir will run for that given task, and then delete them with cleanup at the end of my script.

Is there a better way of handling situations where you don’t know how many devices, their names, or platforms until the moment you need to run code against them?

I would prefer not to have to maintain an ever changing master inventory file of thousands of devices across our global network. It would be much easier if I could just tell nornir at the time of running what devices to hit and how to connect to them.

Hi @dsanders . You could deal with it by writing a custom inventory module. Devices info will be downloaded when an object is being created.