cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1099
Views
0
Helpful
1
Replies

Connect to IOS XR Programmability Sandbox using Ansible/NETCONF

EvanC
Level 1
Level 1

I'd like to connect to this reserved sandbox IOS XR Programmability Sandbox using NETCONF protocol.

 

Firstly, I tested the connection using python ncclient with below lab_env settings. 

The connection is set up successfully.

IOS_XR_r1_rsv = {
"host": "10.10.20.70",
"username": "admin",
"password": "admin",
"netconf_port": 8321,
"ssh_port": 2221
}

 

 

Then,  I tried Ansible Playbook using below configuration

group_var:

 
ansible_connection: ansible.netcommon.network_cli
ansible_network_os: cisco.iosxr.iosxr
ansible_user: admin
ansible_ssh_pass: admin
ansible_password: admin
ansible_port: 2221
 

 

Playbook

---
- name: Configure IOS XR
  hosts: iosxr-rsv
  gather_facts: no

  tasks:
    - name: Change connection mode
      set_fact:
        ansible_connection: netconf
        ansible_port: 8321

    - name: Fetch given yang model and it’s dependent from remote host
      community.yang.fetch:
        name: Cisco-IOS-XR-ifmgr-cfg
        dir: "{{playbook_dir}}/{{inventory_hostname}}/yang_files"
      register: result

The connection is failed. 

ansible.module_utils.connection.ConnectionError: Exception('command timeout triggered, timeout value is 80 secs.\nSee the timeout setting options in the Network Debug and Troubleshooting Guide.')
fatal: [10.10.20.70]: FAILED! => {
    "msg": "Unexpected failure during module execution.",
    "stdout": ""
}

Did anyone come across the similar issue? 

1 Reply 1

@EvanC try to run your playbook command again with -vvv added to enable verbose output. The only time I saw this error was when a command was trying to run from a non-privileged mode.

 

You will get more of a response to code issues/troubleshooting code in the https://learningnetwork.cisco.com/s/topic/0TO3i0000008jY5GAI/devnet-certifications-community 

 

Hope this helps.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io