FAILED! => {"msg": "network os ansible.netcommon.cli_command is not supported"}

Hello everyone

Rocky Linux 9.4
ansible [core 2.15.12]

I’m trying to use connection module: ansible.netcommon.cli_command but I get this error:

fatal: [10.84.0.201]: FAILED! => {“msg”: “network os ansible.netcommon.cli_command is not supported”}

I have a file with variables located in /etc/ansible/group_vars/switches.yml
that looks like this:

ansible_user: admin
ansible_password:
ansible_network_os: ansible.netcommon.cli_command
ansible_connection: network_cli
ansible_become: yes
ansible_become_method: enable
ansible_become_password: my_enable_password

My playbook:


  • name: Retrieve Dell OS6 switch OS version
    hosts: switches
    gather_facts: no # Disable gathering facts since we’re executing a command directly

    vars_files:

    • /etc/ansible/group_vars/switches.yml

    tasks:

    • name: Get OS version
      ansible.netcommon.cli_command:
      commands:
      - show version
      register: os_version_output

    • name: Display OS version
      debug:
      msg: “OS Version of {{ inventory_hostname }} is {{ os_version_output.stdout }}”


My hosts file has this group lines in it:
[switches]
10.84.0.201

I can confirm that module ansible.netcommon is installed.

[root@paok group_vars]# ansible-galaxy collection list | grep ansible.netcommon
ansible.netcommon 6.0.0

[root@paok net]# ansible-galaxy collection list | grep dellemc.os6
dellemc.os6 1.0.7

Do you see anything wrong?

Thank you
Kabamaru

I think, based on the name of your Play, you need to change the value of ansible_network_os to dellemc.os6.os6

See here for details: https://docs.ansible.com/ansible/latest/network/user_guide/platform_dellos6.html#

Hi James

I tried your suggestion and run the playbook. I got this warning:
[WARNING]: ansible-pylibssh not installed, falling back to paramiko
followed by the same error as before.

I installed ansible-pylibssh using pip with no problems and run the playbook again. The warning is gone but the error message remains.


I also tried the playbook, after changing the line ansible.netcommon.cli_command: to dellemc.os6.os6: and I get something different:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: ‘PluginLoader’ object has no attribute ‘find_plugin_with_name’
fatal: [10.84.0.201]: FAILED! => {“msg”: “Unexpected failure during module execution: ‘PluginLoader’ object has no attribute ‘find_plugin_with_name’”, “stdout”: “”}


If run the playbook with -vvv I get:

The full traceback is:
Traceback (most recent call last):
** File “/root/.ansible/collections/ansible_collections/ansible/netcommon/plugins/action/network.py”, line 260, in _find_load_module**
** module = importlib.import_module(context.plugin_resolved_name)**
** File “/usr/lib64/python3.9/importlib/init.py”, line 118, in import_module**
** if name.startswith(‘.’):**
AttributeError: ‘NoneType’ object has no attribute ‘startswith’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
** File “/root/.local/lib/python3.9/site-packages/ansible/executor/task_executor.py”, line 165, in run**
** res = self._execute()**
** File “/root/.local/lib/python3.9/site-packages/ansible/executor/task_executor.py”, line 656, in _execute**
** result = self._handler.run(task_vars=vars_copy)**
** File “/root/.ansible/collections/ansible_collections/dellemc/os6/plugins/action/os6.py”, line 94, in run**
** result = super(ActionModule, self).run(task_vars=task_vars)**
** File “/root/.ansible/collections/ansible_collections/ansible/netcommon/plugins/action/network.py”, line 44, in run**
** filename, module = self._find_load_module()**
** File “/root/.ansible/collections/ansible_collections/ansible/netcommon/plugins/action/network.py”, line 263, in _find_load_module**
** fullname, filename = mloadr.find_plugin_with_name(**
AttributeError: ‘PluginLoader’ object has no attribute ‘find_plugin_with_name’
fatal: [10.84.0.201]: FAILED! => {
** “msg”: “Unexpected failure during module execution: ‘PluginLoader’ object has no attribute ‘find_plugin_with_name’”,**
** “stdout”: “”**
}

It may well be that you also need to use the dellemc.os6 collection modules to run commands against your devices, such as the dellemc.os6.os6_command module.

The collection documentation can be found here: https://docs.ansible.com/ansible/5/collections/dellemc/os6/index.html
Note, this isn’t latest documentation, as this doesn’t appear included in latest. The repo for this collection is here: https://github.com/ansible-collections/dellemc.os6

Thus, you would set ansible_network_os to dellemc.os6.os6 in your switches.yml file.
Then use the dellemc.os6.os6_command module in your playbook (or one of the other supported modules as per link).

Hi

After a lot of trial and error, the playbook worked. This is what I did:
In my playbook changed the line:

ansible.netcommon.cli_command: to dellemc.os6.os6:

Also in the variables files, I changed:

  1. ansible_network_os: from ansible.netcommon.cli_command to dellemc.os6.os6
  2. ansible_connection: from network_cli to ansible.netcommon.network_cli

James thank you very much for pointing me to the right direction. :+1:

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.