ansible - 在 ansible 剧本中使用 netconf_get
问题描述
我正在通过 Ansible 使用 netconf 进行测试,并且在运行 playbook 时不断收到此错误:
ansible.module_utils.connection.ConnectionError: AuthenticationException('Authentication timeout.',)
我可以通过端口 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:无法接收用户身份验证请求
解决方案
看起来我已经找到了自己问题的答案。
我决定只用 python 编写我自己的 netconf 模块,但我遇到了同样的错误。
所以我转而使用安装在另一台机器上的 python 并且相同的代码可以工作。
似乎该服务器上安装的python版本存在问题......
推荐阅读
- android - deviceNotReady 错误:“注册失败”react-native-twilio-programmable-voice
- javascript - cors 启用 axios 获取请求失败
- r - 如何根据小标题中的标准过滤数据框?
- .net-core - 如何停止从一页到另一页的剃刀部分持久状态消息
- html - 具有跨度的响应式 CSS 网格
- python - 将数据从一个数据帧复制到另一个数据帧并根据值替换数据
- python - AWS:无法导入模块“处理程序”:没有名为“numpy”的模块
- jquery - 限制 jQuery 仅附加到一个元素
- java - 奇怪的错误:未创建 Bean,“无法配置端点”
- c++ - 在文本文件中查找字谜