【问题标题】:using netconf_get in an ansible playbook在 ansible 剧本中使用 netconf_get
【发布时间】:2020-12-27 03:36:30
【问题描述】:

我正在通过 Ansible 使用 netconf 进行测试,并且在运行 playbook 时不断收到此错误:

ansible.module_utils.connection.ConnectionError: AuthenticationException('身份验证超时。',)

我可以通过端口 830 使用 ssh 从脚本服务器连接到我的 Cisco 设备: 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: 接收用户认证请求失败

【问题讨论】:

标签: ansible netconf


【解决方案1】:

看来我已经找到了自己问题的答案。

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

所以我转而使用安装在另一台机器上的 python 并且相同的代码可以工作。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-08
    • 1970-01-01
    • 1970-01-01
    • 2022-11-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多