Closed arnaudtuihani closed 2 years ago
I'm running into the same issue since today
Task
- name: Start Copy from Server
net_put:
src: "/etc/ansible/c2960s-universalk9-mz.152-2.E9.bin"
dest: "flash:/c2960s-universalk9-mz.152-2.E9.bin"
vars:
protocol: scp
ansible_command_timeout: 3000
ANSIBLE VERSION
ansible [core 2.13.6]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/tblachetta/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/tblachetta/.local/lib/python3.9/site-packages/ansible
ansible collection location = /home/tblachetta/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.9.15 (main, Oct 12 2022, 19:15:11) [GCC 7.5.0]
jinja version = 3.1.2
libyaml = True
COLLECTION VERSION
# /usr/local/lib/python3.9/dist-packages/ansible_collections
Collection Version
----------------- -------
ansible.netcommon 3.1.3
# /home/tblachetta/.ansible/collections/ansible_collections
Collection Version
----------------- -------
ansible.netcommon 4.1.0
OS / ENVIRONMENT
NAME="Ubuntu"
VERSION="18.04.6 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.6 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
ACTUAL RESULTS
TASK [Start Copy from Server] ****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
task path: /etc/ansible/tasks/cisco_ios_upgrade_new.yml:69
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
redirecting (type: terminal) ansible.builtin.ios to cisco.ios.ios
redirecting (type: cliconf) ansible.builtin.ios to cisco.ios.ios
<10.129.255.100> attempting to start connection
<10.129.255.100> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /usr/local/bin/ansible-connection
<10.129.255.100> found existing local domain socket, using it!
<10.129.255.100> updating play_context for connection
<10.129.255.100>
<10.129.255.100> local domain socket path is /home/tblachetta/.ansible/pc/f6db148676
redirecting (type: modules) ansible.builtin.net_put to ansible.netcommon.net_put
redirecting (type: action) ansible.builtin.net_put to ansible.netcommon.net_put
redirecting (type: action) ansible.builtin.net_put to ansible.netcommon.net_put
Getting network OS from inventory
fatal: [de-bre-ccb-e04-dot1xtest]: FAILED! => {
"changed": false,
"destination": "flash:/c2960x-universalk9-mz.152-7.E3.bin",
"msg": "Exception received: Error transferring file to flash:/c2960x-universalk9-mz.152-7.E3.bin: Initializing SCP session of remote file [flash:/c2960x-universalk9-mz.152-7.E3.bin] for write failed with error [b'Socket error: No such file or directory']"
}
PLAY RECAP ***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
de-bre-ccb-e04-dot1xtest : ok=6 changed=0 unreachable=0 failed=1 skipped=1 rescued=0 ignored=0
Okay I fixed the issue for me. I uninstalled ansible-pylibssh. Now the net_put is working fine again. Don't know how this is related and why this started to be broken?!
@IzxxY can you check if this fixes the issue for you as well?
Hello @crytectobi
I tried to uninstalled ansible-pylibssh and Installed paramiko 2.12. I'm getting this error now:
TASK [dinum.cisco-upgrade-2960S : test copy scp] ********************************************************************************************************************* fatal: [10.10.105.232]: FAILED! => {"changed": false, "destination": "flash:/c2960s-universalk9-mz.152-2.E9.bin", "msg": "Exception received: Failed to import the required Python library (scp) on srv-ansible.admin.nc's Python /usr/bin/python3.8. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
After installing scp
pip3.8 install --user scp
My task is now working !! Thank you @crytectobi
TASK [dinum.cisco-upgrade-2960S : test copy scp] ********************************************************************************************************************* changed: [10.10.105.232]
SUMMARY
I'm trying to upgrade the IOS on my cisco switch with an ansible playbook.
When I try to launch this task :
It fails.
ISSUE TYPE
COMPONENT NAME
module ansible.netcommon (net_put)
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
[at@srv-ansible cisco]$ cat /etc/os-release NAME="Oracle Linux Server" VERSION="8.6" ID="ol" ID_LIKE="fedora" VARIANT="Server" VARIANT_ID="server" VERSION_ID="8.6" PLATFORM_ID="platform:el8" PRETTY_NAME="Oracle Linux Server 8.6" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:oracle:linux:8:6:server" HOME_URL="https://linux.oracle.com/" BUG_REPORT_URL="https://bugzilla.oracle.com/"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8" ORACLE_BUGZILLA_PRODUCT_VERSION=8.6 ORACLE_SUPPORT_PRODUCT="Oracle Linux" ORACLE_SUPPORT_PRODUCT_VERSION=8.6
STEPS TO REPRODUCE
Play this playbook on a cisco switch 2960S / IOS: 12.2(55)SE5
name: COLLECT cisco.ios.facts: gather_subset:
name: CHECK debug: msg:
name: COPY ansible.netcommon.net_put: src: ~/GitLab/ansible-roles/cisco-upgrade-2960S/files/c2960s-universalk9-mz.152-2.E9.bin dest: flash:/c2960s-universalk9-mz.152-2.E9.bin protocol: scp