napalm-automation / napalm-ansible

Apache License 2.0
245 stars 103 forks source link

napalm collection with ansible_network_os fully-qualified #196

Open slefol opened 2 years ago

slefol commented 2 years ago

Since Ansible 2.10, it's recommended to use the fully-qualified collection name (FQCN).

However, when setting ansible_network_os: cisco.ios.ios in the inventory file, a playbook with napalm.napalm.get_facts (for example) returns the following error: "Failed to import napalm driver: Cannot import \"cisco.ios.ios\". Is the library installed?"

It's works with ansible_network_os: ios

Example of task :

ktbyers commented 2 years ago

@slefol That one is a bit tough as it really is Ansible breakage and Ansible isn't really using a collection there (it is just a string that they want to convert into a namespaced string--of course they could have chosen better names originally, but they didn't).

And NAPALM is not using anything from Ansible here i.e. we are not using Ansible component to connect (we just want to use the right napalm driver.

So yeah feel free to write a shim and submit a PR that translates cisco.ios.ios back to ios in the NAPALM code (and does similar things for other NAPALM platforms).

In the interim though I would just use the abbreviated name for ansible_network_os.