carlmontanari / nornir_ansible

Nornir's Ansible inventory plugin
Apache License 2.0
19 stars 10 forks source link

Accessing Group Vars for ansible Inventory #57

Closed parth995 closed 3 years ago

parth995 commented 3 years ago

Hi Team,

I see a bug or challenge may be to access a group vars/items in nornir script when we use ansible as a inventory plugin.

Below thing works :- nr.inventory.hosts[''].items()

Below one Doesn't works :- nr.inventory.groups[''].items()

Versions of package used :- netmiko==3.4.0 nornir==3.1.1 nornir-ansible==2020.9.26 nornir-napalm==0.1.2 nornir-scrapli==2021.1.30 nornir-utils==0.1.2 Python 3.9.5

Any help would be appreciated. Thanks

parth995 commented 3 years ago

Ref :- https://github.com/nornir-automation/nornir/issues/701

carlmontanari commented 3 years ago

that said, even if this issue was opened there, provided details are not enough to assist you. at the minimum, there needs to be minimal reproduction which demonstrates the problem together with versions of python/nornir/plugin.

If you think there is a bug and want to open a PR I'll review, but without a reproducible example/setup I'm going to close this. Feel free to reopen with a reproducible example and I'll try to take a look at some point.

parth995 commented 3 years ago

I have already added a example which works and which doesn't works

parth995 commented 3 years ago

Config.yaml file inventory: plugin: AnsibleInventory options: hostsfile: "inventory/inventory.yaml"

runner: plugin: threaded options: num_workers: 10

defaults.yaml platform: "ios" connection_options: scrapli: extras: auth_strict_key: False