【发布时间】: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: 接收用户认证请求失败
【问题讨论】:
-
我自己不熟悉
netconf,但我看不出您在哪里告诉 Ansible 使用端口 830 连接到您的交换机。 -
@larsks 感谢您的回复。设置 ansible_connection=netconf 默认使用 830 端口:docs.ansible.com/ansible/latest/plugins/connection/netconf.html
-
谢谢,我今天学到了一些东西:)。