FAILED! => {"changed": false, "msg": "paramiko is not installed: No module named 'paramiko'"} ...ignoring

Hello, All

I’m trying to run a playbook, it shows below error saying that “paramiko is not installed: No module named ‘paramiko’”. However, looks like paramiko is already installed on the server. Highly appreciated if anyone share similar experience or any feedback / advice. Thank you.

[root@ansible002 inventories]# ansible-playbook ios/plb-1-1.yml -i inv-test.yml

PLAY [plb-1-1] **************************************************

TASK [Check enable secret is configured] ***********************************************************
fatal: [OOOO-XXX-SW03]: FAILED! => {"changed": false, "msg": "paramiko is not installed: No module named 'paramiko'"}
...ignoring

PLAY RECAP *****************************************************************************************
OOOO-XXX-SW03 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=1

[root@ansible002 inventories]#
[root@ansible002 inventories]# ansible-doc -t connection -l
ansible.builtin.local execute on controller
ansible.builtin.paramiko_ssh Run tasks via python ssh (paramiko)
ansible.builtin.psrp Run tasks over Microsoft PowerShell Remoting Protocol
ansible.builtin.ssh connect via SSH client binary
ansible.builtin.winrm Run tasks over Microsoft's WinRM
ansible.netcommon.grpc Provides a persistent connection using the gRPC protocol
ansible.netcommon.httpapi Use httpapi to run command on network appliances
ansible.netcommon.libssh Run tasks using libssh for ssh connection
ansible.netcommon.netconf Provides a persistent connection using the netconf protocol
ansible.netcommon.network_cli Use network_cli to run command on network appliances
ansible.netcommon.persistent Use a persistent unix socket for connection
[root@ansible002 inventories]#

Hello @bacchus21

The command result in ansible-doc -t connection -l does not necessarily indicate that paramiko is installed.

Could you install paramiko by pip install paramiko just to be sure?

If that does not change the error message, define ansible_python_interpreter as follows.

ansible_python_interpreter: '{{ ansible_playbook_python }}'
2 Likes

Hello there, I’m running into the same error on my onprem network. I’m running a manual playbook through the CLI to test my connection to my cisco device based on the ansible documentation on "create and run your first network Ansible Playbook. Step 2. I use Yum. I ran “yum list | grep -i paramiko” and saw the location did not have an @ so I ran “yum install python3-paramiko --nogpgcheck” and it sucessfully installed now I have an @CCR-RHEL-8_EPEL… but when I rerun my “ansible all -i vyos.example.net, -c ansible.netcommon.network_cli -u my_vyos_user -k -m vyos.vyos.vyos_facts -e ansible_network_os=vyos.vyos.vyos” command, mine is different but I’m not connected to the internet this is just the example, I still get paramiko is not installed. Do you have any advice?

I also changed my ansible.cfg to have [defaults]
transport = paramiko

that interpreter command, do you put that in the ansible.cfg under [defaults]? I did just see this note : If you are running Ansible in a virtual environment, you will also need to add the variable ansible_python_interpreter=/path/to/venv/bin/python