0

I'm trying to configure Cisco IOS XR devices with Ansible. I assume the Cisco.Iosxr collection would be suitable for such task. But the Cisco.Iosxr collection seems to envoke a command "show inventory", which does not exist on my IOS XR devices.

Cisco IOS XR Version:

RP/0/RP0/CPU0:XR3#show version
Tue May 23 08:42:26.758 UTC
Cisco IOS XR Software, Version 7.8.1 LNT
Copyright (c) 2013-2022 by Cisco Systems, Inc.

Build Information:
Built By : ingunawa
Built On : Wed Nov 30 13:00:28 UTC 2022
Build Host : iox-lnx-108
Workspace : /auto/srcarchive13/prod/7.8.1/xrd-control-plane/ws
Version : 7.8.1
Label : 7.8.1

cisco XRd Control Plane
cisco XRd-CP-C-01 processor with 512GB of memory
XR3 uptime is 3 weeks, 6 days, 17 hours, 11 minutes
XRd Control Plane Container

Ansible Playbook

name: Create Config Backup
hosts: CERouters
gather_facts: false
tasks:
  - name: backup
    cisco.iosxr.iosxr_config:
      backup: yes

Ansible playbook output

fatal: [xr3]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"admin": false,
"after": null,
"backup": true,
"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": "line",
"src": null
}
},
"msg": "show inventory\r\n\r ^\r\n% Invalid input detected at '^' marker.\r\nRP/0/RP0/CPU0:XR3#"
}

With the Cisco.Ios collection I'm able to do a backup, but get more errors when trying to configure VRF with Jinja2 templates. But I think Cisco.Iosxr should be the way to go.

My last approach would be to use the ansible.netcommon.netconf_config module to send JSON/XML commands to the Cisco IOS XR devices, which does work, but is very tedious.

Or is there another Ansible collection to configure Cisco IOS XR devices?

Thanks for any help.

  • It looks like the module is trying to run the `show inventory` command. Is that a valid command? Are you able to run it successfully? Should you be setting `become: true` to activate "enable" mode? – larsks May 23 '23 at 11:38
  • This command does not exist on my IOS XR device. Not sure if we're running a strange OS, or if this command just does not exist on IOS XR devices and this ansible collection is faulty. `RP/0/RP0/CPU0:XR2#show inventory % Invalid input detected` As far as I'm aware there is no become on cisco devices? https://docs.ansible.com/ansible/latest/network/user_guide/platform_iosxr.html – r3volutionxxx May 23 '23 at 12:40
  • I'm not familiar with Cisco devices, but many network devices have an `enable` command that is used to transition into privileged mode. – larsks May 23 '23 at 13:31
  • @larsks this is true. But the command 'show inventory' doesn't work either when im manually entering this command on my Cisco IOS XR devices. Not when I'm in the 'enable' or 'config' mode or without these modes activated. That's why I think there's either a problem with my Cisco IOS XR version or with the Cisco.Iosxr ansible collection. But I assume it's the frist. – r3volutionxxx Jun 06 '23 at 11:21

0 Answers0