Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Ansible: iosxr_command “show bgp neighbor x.x.x.x” connection failed

I am currently getting a problem when trying to run the iosxr_command module "command" function for the command "show bgp neighbor x.x.x.x(ip)"

---
- hosts: IOS-XR
  connection: local
  gather_facts: no
  tasks:
  - iosxr_command:
      commands:
        - show bgp neighbor 192.168.1.1

The router returns:

RP/0/RSP0/CPU0:DEVICE01#show bgp neighbor 192.168.1.1
Fri Nov 30 15:53:53.648 PST
% Neighbor not found

However, the ansible module crashes.

The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_ERGRam/ansible_module_iosxr_command.py", line 221, in <module>
    main()
  File "/tmp/ansible_ERGRam/ansible_module_iosxr_command.py", line 191, in main
    responses = run_command(module, commands)
  File "/tmp/ansible_ERGRam/ansible_modlib.zip/ansible/module_utils/network/iosxr/iosxr.py", line 472, in run_command
  File "/tmp/ansible_ERGRam/ansible_modlib.zip/ansible/module_utils/connection.py", line 174, in __rpc__
ansible.module_utils.connection.ConnectionError: show bgp neighbor 192.168.1.1
% Neighbor not found
RP/0/RSP0/CPU0:DEVICE01#

fatal: [DEVICE01]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_ERGRam/ansible_module_iosxr_command.py\", line 221, in <module>\n    main()\n  File \"/tmp/ansible_ERGRam/ansible_module_iosxr_command.py\", line 191, in main\n    responses = run_command(module, commands)\n  File \"/tmp/ansible_ERGRam/ansible_modlib.zip/ansible/module_utils/network/iosxr/iosxr.py\", line 472, in run_command\n  File \"/tmp/ansible_ERGRam/ansible_modlib.zip/ansible/module_utils/connection.py\", line 174, in __rpc__\nansible.module_utils.connection.ConnectionError: show bgp neighbor 192.168.1.1\r\n\r% Neighbor not found\r\nRP/0/RSP0/CPU0:DEVICE01#\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE",
    "rc": 1
}

PLAY RECAP **************************************************************************************************************
DEVICE01               : ok=0    changed=0    unreachable=0    failed=1

Playbook run took 0 days, 0 hours, 0 minutes, 6 seconds

Comments