Replies: 2 comments 2 replies
-
Creating an inventory from a dictionary isn't currently supported. Shouldn't be hard to create an inventory plugin that takes a dictionary and creates an inventory. Specially after #727 is completed. If you want to go down that path you may want to contribute it to https://github.com/nornir-automation/nornir_utils as it may be useful to others. |
Beta Was this translation helpful? Give feedback.
1 reply
-
I never used it but nornir-salt has a DictInventory Plugin https://nornir-salt.readthedocs.io/en/latest/Inventory%20Plugins.html#dictinventory-plugin |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I used to do this with Nornir 2 and then once I updated to Nornir 3 I hadn't really bothered but in some cases, it's easier for me to just create an inventory on the fly when things are dynamic rather than have a predefined YAML file. Currently, I just build the YAML file and store it as a workaround, but I would like to get back to doing this in line with code when it suits me. Looking to see if anyone else is doing this and what the code might look like. The working example below is Nornir 2 so core= becomes runner= I belive and such, mostly the first part with SimpleInventory that I'm getting stuck on. I was attempting something like this:
And getting this exception:
Example of old Nornir 2 code that worked:
Beta Was this translation helpful? Give feedback.
All reactions