在ansible剧本中使用netconf_get

问题描述

我正在通过Ansible使用netconf进行测试,并且在运行剧本时不断出现此错误

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

我肯定会从脚本服务器通过端口830到我的Cisco设备使用ssh: ssh cisco@10.1.1.1 -p 830 -s netconf

这是剧本:

---
- 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

库存是这样的:

[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

我应该添加,尝试上面的播放时,我在cisco设备的控制台上看到此错误

9月8日17:37:42.218 UTC:SSHD_ [67398]:%Security-SSHD-3-ERR_GENERAL: 未能收到用户身份验证请求

解决方法

好像我找到了自己问题的答案。

我决定只用python编写自己的netconf模块,但遇到了同样的错误。

所以我转而使用安装在另一台计算机上的python,并且相同的代码有效。

该服务器上安装的python版本似乎有问题...

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...