using netconf_get in an ansible playbook

549 views Asked by At

I am testing out using netconf via Ansible and I keep getting this error when running the playbook:

ansible.module_utils.connection.ConnectionError: AuthenticationException('Authentication timeout.',)

I am ablte to use ssh over port 830 to my Cisco device from the scripting server: ssh [email protected] -p 830 -s netconf

This is the playbook:

---
- name: My Playbook
  hosts: 'my_host'
  gather_facts: false
    
  tasks:
  - name: Execute the get_config RPC
    netconf_get:
      display: json
    register: result
  - name: Print the configuration as JSON
    debug:
      var: result.output

And the inventory is something like this:

[my_lab:children]
my_lab_iosxr

[my_lab:vars]
look_for_keys = False
host_key_checking  = False
ansible_ssh_pass = 'cisco'
ansible_user = 'cisco'

[my_lab_iosxr]
my_host ansible_host=10.1.1.1 ansible_network_os=iosxr ansible_connection=netconf

I should add, I see this error on the console of the cisco device when attempting the play above:

Sep 8 17:37:42.218 UTC: SSHD_[67398]: %SECURITY-SSHD-3-ERR_GENERAL : Failed to receive User authentication request

1

There are 1 answers

0
rev_it_up On

Looks like I have found the answer to my own question.

I decided to just write my own netconf module in python and I was getting the same error.

So I switched to using python installed on another machine and the same code works.

Seems like there is an issue with the version of python installed on that server...