You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cisco IOS XR config option replace: config is not working and throwing an error as below
fatal: [P9]: FAILED! => {"changed": false, "msg": "Writing to remote file [b'/harddisk:/ansible_config.txt'] failed with error [Generic failure: Invalid SSH_FXP_STATUS message]"}
While checking on the router, the file seem to be present and its contents were also verified.
RP/0/RP0/CPU0:P9#cd harddisk:
RP/0/RP0/CPU0:P9#dir | i ansible
Fri Feb 17 00:18:28.204 UTC
59 -rwx------. 1 850 Feb 17 00:17 ansible_config.txt
RP/0/RP0/CPU0:P9#
(vntdvops) lab@netdevops:~/ansible/cisco_xr$ ssh -l cisco p9
(cisco@p9) Password:
RP/0/RP0/CPU0:P9#sh ver
Fri Feb 17 00:14:02.922 UTC
Cisco IOS XR Software, Version 7.5.2
Copyright (c) 2013-2022 by Cisco Systems, Inc.
Build Information:
Built By : ingunawa
Built On : Tue Apr 26 18:04:31 PDT 2022
Built Host : iox-ucs-061
Workspace : /auto/srcarchive14/prod/7.5.2/xrv9k/ws
Version : 7.5.2
Location : /opt/cisco/XR/packages/
Label : 7.5.2
cisco IOS-XRv 9000 () processor
System uptime is 1 day 12 hours 15 minutes
RP/0/RP0/CPU0:P9#
STEPS TO REPRODUCE
(vntdvops) lab@netdevops:~/ansible/cisco_xr$ cat restore_topology_play.yaml
---
- name: Restore Topology line by linehosts: P9vars:
tasks:
- name: "Replace config with Commit confirmed"cisco.iosxr.iosxr_config:
src: "xrcfg/{{ hostname }}.base.xrcfg"replace: config(vntdvops) lab@netdevops:~/ansible/cisco_xr$
EXPECTED RESULTS
ACTUAL RESULTS
(vntdvops) lab@netdevops:~/ansible/cisco_xr$ ansible-playbook restore_topology_play.yaml
PLAY [Restore Topology line by line] *************************************************************************************************************************************************************************************
TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************
ok: [P9]
TASK [Replace config with Commit confirmed] ******************************************************************************************************************************************************************************
fatal: [P9]: FAILED! => {"changed": false, "msg": "Writing to remote file [b'/harddisk:/ansible_config.txt'] failed with error [Generic failure: Invalid SSH_FXP_STATUS message]"}
PLAY RECAP ***************************************************************************************************************************************************************************************************************
P9 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
(vntdvops) lab@netdevops:~/ansible/cisco_xr$
(vntdvops) lab@netdevops:~/ansible/cisco_xr$ ansible-playbook restore_topology_play.yaml -vvvv
ansible-playbook [core 2.14.2]
config file = /home/lab/ansible/cisco_xr/ansible.cfg
configured module search path = ['/home/lab/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/lab/vntdvops/lib/python3.10/site-packages/ansible
ansible collection location = /home/lab/.ansible/collections:/usr/share/ansible/collections
executable location = /home/lab/vntdvops/bin/ansible-playbook
python version = 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] (/home/lab/vntdvops/bin/python)
jinja version = 3.1.2
libyaml = True
Using /home/lab/ansible/cisco_xr/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /home/lab/ansible/cisco_xr/inventory/hosts.ini as it did not pass its verify_file() method
script declined parsing /home/lab/ansible/cisco_xr/inventory/hosts.ini as it did not pass its verify_file() method
auto declined parsing /home/lab/ansible/cisco_xr/inventory/hosts.ini as it did not pass its verify_file() method
yaml declined parsing /home/lab/ansible/cisco_xr/inventory/hosts.ini as it did not pass its verify_file() method
Parsed /home/lab/ansible/cisco_xr/inventory/hosts.ini inventory source with ini plugin
Loading collection cisco.iosxr from /home/lab/vntdvops/lib/python3.10/site-packages/ansible_collections/cisco/iosxr
Loading callback plugin default of type stdout, v2.0 from /home/lab/vntdvops/lib/python3.10/site-packages/ansible/plugins/callback/default.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
PLAYBOOK: restore_topology_play.yaml *************************************************************************************************************************************************************************************
Positional arguments: restore_topology_play.yaml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('all',)
inventory: ('/home/lab/ansible/cisco_xr/inventory/hosts.ini',)
forks: 50
1 plays in restore_topology_play.yaml
PLAY [Restore Topology line by line] *************************************************************************************************************************************************************************************
TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************
task path: /home/lab/ansible/cisco_xr/restore_topology_play.yaml:2
Loading collection ansible.netcommon from /home/lab/vntdvops/lib/python3.10/site-packages/ansible_collections/ansible/netcommon
<P9> attempting to start connection
<P9> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /home/lab/vntdvops/bin/ansible-connection
<P9> local domain socket does not exist, starting it
<P9> control socket path is /home/lab/.ansible/pc/92f3f89ae0
<P9> Loading collection ansible.netcommon from /home/lab/vntdvops/lib/python3.10/site-packages/ansible_collections/ansible/netcommon
<P9> Loading collection cisco.iosxr from /home/lab/vntdvops/lib/python3.10/site-packages/ansible_collections/cisco/iosxr
<P9> local domain socket listeners started successfully
<P9> loaded cliconf plugin ansible_collections.cisco.iosxr.plugins.cliconf.iosxr from path /home/lab/vntdvops/lib/python3.10/site-packages/ansible_collections/cisco/iosxr/plugins/cliconf/iosxr.py for network_os cisco.iosxr.iosxr
<P9> ssh type is set to auto
<P9> autodetecting ssh_type
<P9> ssh type is now set to libssh
<P9>
<P9> local domain socket path is /home/lab/.ansible/pc/92f3f89ae0
<P9> ESTABLISH LOCAL CONNECTION FOR USER: lab
<P9> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/lab/.ansible/tmp/ansible-local-63534y_akmpxr `"&& mkdir "` echo /home/lab/.ansible/tmp/ansible-local-63534y_akmpxr/ansible-tmp-1676592936.8793008-63538-263093498644955 `" && echo ansible-tmp-1676592936.8793008-63538-263093498644955="` echo /home/lab/.ansible/tmp/ansible-local-63534y_akmpxr/ansible-tmp-1676592936.8793008-63538-263093498644955 `" ) && sleep 0'
Using module file /home/lab/vntdvops/lib/python3.10/site-packages/ansible_collections/cisco/iosxr/plugins/modules/iosxr_facts.py
<P9> PUT /home/lab/.ansible/tmp/ansible-local-63534y_akmpxr/tmpsuuur3sh TO /home/lab/.ansible/tmp/ansible-local-63534y_akmpxr/ansible-tmp-1676592936.8793008-63538-263093498644955/AnsiballZ_iosxr_facts.py
<P9> EXEC /bin/sh -c 'chmod u+x /home/lab/.ansible/tmp/ansible-local-63534y_akmpxr/ansible-tmp-1676592936.8793008-63538-263093498644955/ /home/lab/.ansible/tmp/ansible-local-63534y_akmpxr/ansible-tmp-1676592936.8793008-63538-263093498644955/AnsiballZ_iosxr_facts.py && sleep 0'
<P9> EXEC /bin/sh -c '/home/lab/vntdvops/bin/python /home/lab/.ansible/tmp/ansible-local-63534y_akmpxr/ansible-tmp-1676592936.8793008-63538-263093498644955/AnsiballZ_iosxr_facts.py && sleep 0'
<P9> EXEC /bin/sh -c 'rm -f -r /home/lab/.ansible/tmp/ansible-local-63534y_akmpxr/ansible-tmp-1676592936.8793008-63538-263093498644955/ > /dev/null 2>&1 && sleep 0'
ok: [P9]
TASK [Replace config with Commit confirmed] ******************************************************************************************************************************************************************************
task path: /home/lab/ansible/cisco_xr/restore_topology_play.yaml:7
Loading collection ansible.netcommon from /home/lab/vntdvops/lib/python3.10/site-packages/ansible_collections/ansible/netcommon
<P9> attempting to start connection
<P9> using connection plugin ansible.netcommon.network_cli
Found ansible-connection at path /home/lab/vntdvops/bin/ansible-connection
<P9> found existing local domain socket, using it!
<P9> invoked shell using ssh_type: libssh
<P9> ssh connection done, setting terminal
<P9> loaded terminal plugin for network_os cisco.iosxr.iosxr
<P9> firing event: on_open_shell()
<P9> ssh connection has completed successfully
<P9> updating play_context for connection
<P9>
<P9> local domain socket path is /home/lab/.ansible/pc/92f3f89ae0
<P9> Using network group action cisco.iosxr.iosxr for cisco.iosxr.iosxr_config
<P9> ANSIBLE_NETWORK_IMPORT_MODULES: enabled
<P9> ANSIBLE_NETWORK_IMPORT_MODULES: found cisco.iosxr.iosxr_config at /home/lab/vntdvops/lib/python3.10/site-packages/ansible_collections/cisco/iosxr/plugins/modules/iosxr_config.py
<P9> ANSIBLE_NETWORK_IMPORT_MODULES: running cisco.iosxr.iosxr_config
<P9> ANSIBLE_NETWORK_IMPORT_MODULES: complete
The full traceback is:
File "/home/lab/vntdvops/lib/python3.10/site-packages/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/iosxr.py", line 503, in copy_file
conn.copy_file(source=src, destination=dst, proto=proto)
File "/home/lab/vntdvops/lib/python3.10/site-packages/ansible/module_utils/connection.py", line 200, in __rpc__
raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
fatal: [P9]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"admin": false,
"after": null,
"backup": false,
"backup_options": null,
"before": null,
"comment": "configured by iosxr_config",
"config": null,
"disable_default_comment": false,
"exclusive": false,
"force": false,
"label": null,
"lines": null,
"match": "line",
"parents": null,
"replace": "config",
"src": "username cisco\n group root-lr\n group cisco-support\n secret 10 $6$m69UO/m0cK.e3O/.$EtYXDVl3/aphJkazxKy145fyIY/./Xxt1fi7B3tjYemXr6pzHEJRNfq1DxNJ..WlAQx4wFr6kJesSGtKLv8/k/\n!\ncall-home\n service active\n contact smart-licensing\n profile CiscoTAC-1\n active\n destination transport-method email disable\n destination transport-method http\n !\n!\n\ninterface MgmtEth0/RP0/CPU0/0\n ipv4 address 192.168.18.9 255.255.255.0\n!\ninterface GigabitEthernet0/0/0/0\n shutdown\n!\ninterface GigabitEthernet0/0/0/1\n shutdown\n!\ninterface GigabitEthernet0/0/0/2\n shutdown\n!\ninterface GigabitEthernet0/0/0/3\n shutdown\n!\ninterface GigabitEthernet0/0/0/4\n shutdown\n!\ninterface GigabitEthernet0/0/0/5\n shutdown\n!\ninterface GigabitEthernet0/0/0/6\n shutdown\n!\ninterface GigabitEthernet0/0/0/7\n shutdown\n!\n\nssh client source-interface MgmtEth0/RP0/CPU0/0\nssh server vrf default\n\nroot\n\n"
}
},
"msg": "Writing to remote file [b'/harddisk:/ansible_config.txt'] failed with error [Generic failure: Invalid SSH_FXP_STATUS message]"
}
PLAY RECAP ***************************************************************************************************************************************************************************************************************
P9 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
(vntdvops) lab@netdevops:~/ansible/cisco_xr$
The text was updated successfully, but these errors were encountered:
This issue is because of ansible/pylibssh#222 as here the ssh_type is by default libssh @hmntsharma please use following configuration:
ansible_network_cli_ssh_type: paramiko
SUMMARY
Cisco IOS XR config option
replace: config
is not working and throwing an error as belowfatal: [P9]: FAILED! => {"changed": false, "msg": "Writing to remote file [b'/harddisk:/ansible_config.txt'] failed with error [Generic failure: Invalid SSH_FXP_STATUS message]"}
While checking on the router, the file seem to be present and its contents were also verified.
The last of the examples of the cisco.iosxr.iosxr cliconf suggests it should have.
The results were same, with or without commit confirmed, the replace always throws the same error.
Please help!
Thanks!
ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: