nokia / ansible-networking-collections

BSD 3-Clause "New" or "Revised" License
39 stars 17 forks source link

cli_command etc. cannot be fully qualified #3

Closed cwiech closed 4 years ago

cwiech commented 4 years ago

The collection does not allow the commands to be fully qualified like regular collections. We need be able to fully qualify the namespace for "cli_command" so that we do not collide with other modules or collections from other vendors. The following will work, however, fully qualifying the roles/modules etc. should be a standard.

  - name: sros command load the config
    nokia.sros.cli_command:
vagrant@ubuntu-bionic:~/git/ansible-verifier$ ansible-playbook -i hosts nokia-testconfigs.yml --tags=ear1.nso5
ERROR! couldn't resolve module/action 'nokia.sros.cli_command'. This often indicates a misspelling, missing collection, or incorrect module path.

yes the following will work, but so should "nokia.sros.cli_command".

  collections:
  - nokia.sros
hellt commented 4 years ago

Hi @cwiech that is expected behavior. cli_command is not part of the nokia.sros collection, it is a module of generic ansible distribution, therefore the FQCN fails.

The way the networking collection work is by providing plugins, such as CliConf. Therefore you won't have a namespace collision using the same cli_command name, moreover, that was the intention to create the generic module with a name cli_command that will work with all the vendors.

Your differentiator here is the variable ansible_network_os. Whatever you have in that variable will load the right plugin from the right collection

/cc @wisotzky

cwiech commented 4 years ago

Thanks for the update. I am not familiar with the the cli_command module, I didn't realize how it was meant to work.