I am testing ntc_file_copy to upload IOS-XE images to a couple of Cisco ISRs. When a manual scp command is used from the Ansible host to the router, it works but when I used Ansible it does not. Please note that I have another playbook for just plain IOS devices and that works.
Traceback (most recent call last):
File "/tmp/ansible_aU0ebx/ansible_module_ntc_file_copy.py", line 274, in <module>
main()
File "/tmp/ansible_aU0ebx/ansible_module_ntc_file_copy.py", line 241, in main
remote_exists = device.file_copy_remote_exists(local_file, remote_file, file_system=file_system)
File "/usr/local/lib/python2.7/dist-packages/pyntc-0.0.5-py2.7.egg/pyntc/devices/ios_device.py", line 141, in file_copy_remote_exists
if fc.check_file_exists() and fc.compare_md5():
File "build/bdist.linux-i686/egg/netmiko/scp_handler.py", line 138, in check_file_exists
ValueError: Unexpected output from check_file_exists
fatal: [ch0i1-v1]: FAILED! => {
"changed": false,
"failed": true,
"invocation": {
"module_name": "ntc_file_copy"
},
"module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_aU0ebx/ansible_module_ntc_file_copy.py\", line 274, in <module>\n main()\n File \"/tmp/ansible_aU0ebx/ansible_module_ntc_file_copy.py\", line 241, in main\n remote_exists = device.file_copy_remote_exists(local_file, remote_file, file_system=file_system)\n File \"/usr/local/lib/python2.7/dist-packages/pyntc-0.0.5-py2.7.egg/pyntc/devices/ios_device.py\", line 141, in file_copy_remote_exists\n if fc.check_file_exists() and fc.compare_md5():\n File \"build/bdist.linux-i686/egg/netmiko/scp_handler.py\", line 138, in check_file_exists\nValueError: Unexpected output from check_file_exists\n",
"module_stdout": "",
"msg": "MODULE FAILURE"
My playbook:
- name: COPY IMAGE TO DEVICE
ntc_file_copy:
platform: cisco_ios_ssh
local_file: /home/nncse/Downloads/{{ ios_xe_isr_version }}
remote_file: "{{ ios_xe_isr_version }}"
host: "{{ inventory_hostname }}"
username: "{{ username }}"
password: "{{ password }}"
port: 22
file_system: "bootflash:"
register: scp_ios_xe_isr_status
when: dir_ios_xe_isr.stdout_lines != "{{ ios_xe_isr_version }}"
- debug: msg="{{ scp_ios_xe_isr_status.transfer_status }} to {{ inventory_hostname }}. The image is in the device"
Hello again! Hope you guys are well.
I am testing ntc_file_copy to upload IOS-XE images to a couple of Cisco ISRs. When a manual scp command is used from the Ansible host to the router, it works but when I used Ansible it does not. Please note that I have another playbook for just plain IOS devices and that works.
Thanks in advance.
TRACEBACK error when running Ansible playbook;
My playbook:
My group_vars yaml file: