Unexpected playbook error "msg": "the connection plugin 'network_cli' was not found"

Hello, All

I’m getting the following errors while I was running a playbook. It used to be working fine before. However, the old server was broken and, we built a new server. Not sure it’s because of ansible version, but keep getting these error for all playbooks. The current ansible version is ansible [core 2.14.2]

[root@ansible002 inventories]# ansible ios -i $ANSPATH/inventories/inv-test-simple_for_testing.yml -m ping
OOOOO-XXX-SW01 | FAILED! => {
"msg": "the connection plugin 'network_cli' was not found"
}
[root@ansible002 inventories]#

  • my code!
    all:
    children:
    ios:
    vars:
    ansible_network_os: ios
    ansible_connection: network_cli
    hosts:
    OOOOO-XXX-SW01:

And there were some feedback that network_cli became part of the ansible.netcommon collection. Is installing ansible-galaxy the only solution to resolve this issue?

Actually, I tried to install ansible.netcommon collection, but keep getting the following error. Does anyone have any clue?

[root@ansible002 ~]$ ansible-galaxy collection install ansible.netcommon --force Starting galaxy collection install process
Process install dependency map
[WARNING]: Skipping Galaxy server https://galaxy.ansible.com. Got an unexpected error when getting available versions of collection ansible.netcommon: Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/': <urlopen error TLS/SSL connection has been closed (EOF) (_ssl.c:992)>
ERROR! Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/': <urlopen error TLS/SSL connection has been closed (EOF) (_ssl.c:992)>
[root@ansible002 ~]$

Hello @bacchus21 welcome to the community!

You’re quite right; the installation of the ansible.netcommon collection is needed to use the network_cli plugin. I was able to somehow replicate your scenario (but I don’t have an ios device available right now, so I just can’t test it 100%). Anyway, I’m sharing my exec log with you:

(ansible_ve) [11:34:01] jbericat@control_node:~/DEV/repos/personal/ansible-forum$ ansible ios -i inventory/ -m ping --user root --ask-pass
SSH password: 
dns | FAILED! => {
    "msg": "the connection plugin 'ansible.netcommon.network_cli' was not found"
}
(ansible_ve) [11:35:28] jbericat@control_node:~/DEV/repos/personal/ansible-forum$ ansible-galaxy collection install ansible.netcommon
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/ansible-netcommon-5.3.0.tar.gz to /home/jbericat/.ansible/tmp/ansible-local-29248cg1dfomc/tmp422gzlm3/ansible-netcommon-5.3.0-7tfrcp_f
Installing 'ansible.netcommon:5.3.0' to '/home/jbericat/DEV/repos/personal/ansible-forum/"/home/jbericat/.ansible/collections/ansible_collections/ansible/netcommon'
Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/ansible-utils-2.11.0.tar.gz to /home/jbericat/.ansible/tmp/ansible-local-29248cg1dfomc/tmp422gzlm3/ansible-utils-2.11.0-0a_fw5z5
ansible.netcommon:5.3.0 was installed successfully
Installing 'ansible.utils:2.11.0' to '/home/jbericat/DEV/repos/personal/ansible-forum/"/home/jbericat/.ansible/collections/ansible_collections/ansible/utils'
ansible.utils:2.11.0 was installed successfully
(ansible_ve) [11:35:53] jbericat@control_node:~/DEV/repos/personal/ansible-forum$ ansible ios -i inventory/ -m ping --user root --ask-pass
SSH password: 
dns | FAILED! => {
    "msg": "network os ios is not supported"
}
(ansible_ve) [11:36:02] jbericat@control_node:~/DEV/repos/personal/ansible-forum$ 

So, it seems that the root of your problem is that ssl error you got when installing the collection. If you have some kind of a rush, you could download it manually from Galaxy and install from the tar.gz, like this:

ansible-galaxy collection install ansible-netcommon-5.3.0.tar.gz

Meanwhile, I will try to remember how I did troubleshoot this very same ansible-galaxy error (it happened to me before).

Cheers!

1 Like

found it, that’s how I believe I fixed it:

sudo update-ca-certificates --fresh
export SSL_CERT_DIR=/etc/ssl/certs

You can also try disabling tls certs on ansible.cfg (that is not something I’d do in production, but just for debugging sake):

https://docs.ansible.com/ansible/latest/reference_appendices/config.html#galaxy-ignore-certs

Anyway, there could be many other reasons for it to fail… For example, I’ve also seen similar behaviour when running ansible tasks against https nodes from a docker container (EE) that was behind a layer 7 firewall.

See if that helps…

cheers!

3 Likes

Thank you very much for your comments and support. I also tried to install ansible-galaxy collection manually. But still having the same (_ssl.c:992)> error.

[root@ansible002 ~]# ansible-galaxy collection install ansible-netcommon-5.3.0.tar.gz
Starting galaxy collection install process
Process install dependency map
[WARNING]: Skipping Galaxy server https://galaxy.ansible.com. Got an unexpected error when getting available versions of collection ansible.utils: Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/': <urlopen error TLS/SSL connection has been closed (EOF) (_ssl.c:992)>
ERROR! Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/': <urlopen error TLS/SSL connection has been closed (EOF) (_ssl.c:992)>
[root@ansible002 ~]#

Thank you very much again. Unfortunately, the issue is not resolved yet.

[root@ansible002 ~]# update-ca-certificates --fresh
-bash: update-ca-certificates: command not found
[root@ansible002 ~]#

Oh, that’s a dependency error. I mean, ansible.netcommon needs the prior installation of ansible.utils, so it’s trying to install it from Galaxy. You can also try to install this one manually. Anyway, that does not fix your problem, it’s just a temporary patch… I’m quite busy today but I’m really interested on this particular issue, so I’ll try to find time to think harder about it.

Hello again,

Try installing openssl first please

Thank you very much for your advice, but openssl is already installed.

[root@ansible002 ~]# openssl version -a
OpenSSL 3.0.7 1 Nov 2022 (Library: OpenSSL 3.0.7 1 Nov 2022)
built on: Thu Jul 13 00:00:00 2023 UTC
platform: linux-x86_64
options: bn(64,64)
compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -O3 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wa,--noexecstack -Wa,--generate-missing-build-notes=yes -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DZLIB -DNDEBUG -DPURIFY -DDEVRANDOM="\"/dev/urandom\"" -DREDHAT_FIPS_VERSION="\"3.0.7-38f89367593abbfc\"" -DSYSTEM_CIPHERS_FILE="/etc/crypto-policies/back-ends/openssl.config"
OPENSSLDIR: "/etc/pki/tls"
ENGINESDIR: "/usr/lib64/engines-3"
MODULESDIR: "/usr/lib64/ossl-modules"
Seeding source: os-specific
CPUINFO: OPENSSL_ia32cap=0xfeda32034f8bffff:0xd09e2fb9
[root@ansible002 ~]#

My mistake sorry, I just double checked, the package you have to install should be this one instead (ubuntu install, just adapt it for your distro):

sudo apt-get install ca-certificates
1 Like

Highly appreciated on your help. Yes, I also tried to install ansible.utils but the issue still exists.

[root@ansible002 ~]# ansible-galaxy collection install ansible.utils
Starting galaxy collection install process
Process install dependency map
[WARNING]: Skipping Galaxy server https://galaxy.ansible.com. Got an unexpected error when getting available versions of collection ansible.utils: Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/': <urlopen error [Errno 111] Connection refused>
ERROR! Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/': <urlopen error [Errno 111] Connection refused>
[root@ansible002 ~]#

No but the idea here was to download the collection and install it manually using the tar.gz, like you did in previous posts

1 Like

Thank you very much for your advice. Highly Highly appreciated!!! Now things are OK. Looks like all the issues were related with dependencies.

[root@ansible002 ansible_collections]# ansible-galaxy collection install ansible-utils-2.11.0.tar.gz
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Installing 'ansible.utils:2.11.0' to '/root/.ansible/collections/ansible_collections/ansible/utils' ansible.utils:2.11.0 was installed successfully
[root@ansible002 ansible_collections]#

[root@ansible002 ansible_collections]# ansible-galaxy collection install ansible-netcommon-5.3.0.tar.gz
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Installing 'ansible.netcommon:5.3.0' to '/root/.ansible/collections/ansible_collections/ansible/netcommon' ansible.netcommon:5.3.0 was installed successfully
'ansible.utils:2.11.0' is already installed, skipping.
[root@ansible002 ansible_collections]#
[root@ansible002 ansible]# ansible-galaxy collection list

# /root/.ansible/collections/ansible_collections
Collection Version
----------------- -------
ansible.netcommon 5.3.0
ansible.utils 2.11.0
[root@ansible002 ansible]#

I will ask many questions from now on other topics, so let’s discuss a lot. Thank you again. Cheers!!!

2 Likes

Excellent @bacchus21 so glad we could workaorund it.

If you think one of my posts helped you to fix the issue, could you tick the appropriate solved checkbox, please? This way other people will find the best solution faster :wink:

Looking forward to it! see you around mate :slight_smile:

EDIT: Also, if you end-up trying the update-ca-certificates --fresh thing, I’d really want to know if that fixes the problem with the ansible-galaxy downloads from CLI. Thank you!

1 Like

Actually, update-ca-certificates --fresh didn’t work for me.
[root@ansible002 ~]# update-ca-certificates --fresh
-bash: update-ca-certificates: command not found
[root@ansible002 ~]#

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