networking - 使用 junos_vlan 时 ncclient 超时
问题描述
我使用 ansible 进行网络自动化。通常一切都很好,但是当尝试在特定的瞻博网络交换机上创建 vlan 时,我得到了ncclient timed out while waiting for an rpc reply
错误。我使用junos_vlan
模块。
我尝试延长超时时间ansible.cfg
,ansible_connection
从network_cli
到netconf
等,但这些都没有帮助。
可以从服务器端或交换机端做些什么吗?
我读到一个人找到了编辑模块文件的解决方法: Ansible,Juniper CLI 命令。超时错误?
我可以用同样的方法达到预期的效果吗?
我使用ansible 2.8.1
和python 3.6.3
。设备有 JUNOS 14.1X53-D47.3
固件。
有什么建议么?
这是失败的输出:
TASK [Setting vlan description and giving vlanID] **********************************************
task path: /opt/ansible/roles/juniper/tasks/add_vlan_sw.yml:2
META: noop
META: noop
<x.x.x.x> ESTABLISH NETCONF SSH CONNECTION FOR USER: Ansible on PORT 22 TO x.x.x.x
<x.x.x.x> ESTABLISH LOCAL CONNECTION FOR USER: root
<x.x.x.x> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-233162pe2oyh4/ansible-tmp-1565773542.046394-83274056275477 `" && echo ansible-tmp-1565773542.046394-83274056275477="` echo /root/.ansible/tmp/ansible-local-233162pe2oyh4/ansible-tmp-1565773542.046394-83274056275477 `" ) && sleep 0'
Using module file /opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/ansible/modules/network/junos/junos_vlan.py
<x.x.x.x> PUT /root/.ansible/tmp/ansible-local-233162pe2oyh4/tmpyr3gfpgt TO /root/.ansible/tmp/ansible-local-233162pe2oyh4/ansible-tmp-1565773542.046394-83274056275477/AnsiballZ_junos_vlan.py
<x.x.x.x> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-233162pe2oyh4/ansible-tmp-1565773542.046394-83274056275477/ /root/.ansible/tmp/ansible-local-233162pe2oyh4/ansible-tmp-1565773542.046394-83274056275477/AnsiballZ_junos_vlan.py && sleep 0'
<x.x.x.x> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-local-233162pe2oyh4/ansible-tmp-1565773542.046394-83274056275477/AnsiballZ_junos_vlan.py && sleep 0'
<x.x.x.x> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-233162pe2oyh4/ansible-tmp-1565773542.046394-83274056275477/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
File "/tmp/ansible_junos_vlan_payload_a3tXYK/ansible_junos_vlan_payload.zip/ansible/module_utils/network/junos/junos.py", line 204, in unlock_configuration
response = conn.unlock()
File "/tmp/ansible_junos_vlan_payload_a3tXYK/ansible_junos_vlan_payload.zip/ansible/module_utils/network/common/netconf.py", line 76, in __rpc__
return self.parse_rpc_error(to_bytes(rpc_error, errors='surrogate_then_replace'))
File "/tmp/ansible_junos_vlan_payload_a3tXYK/ansible_junos_vlan_payload.zip/ansible/module_utils/network/common/netconf.py", line 108, in parse_rpc_error
raise ConnectionError(rpc_error)
fatal: [chi-leafsw06]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"active": true,
"aggregate": null,
"description": "Client-100001-dedicated-network",
"filter_input": null,
"filter_output": null,
"host": null,
"interfaces": null,
"l3_interface": null,
"name": "vlan777",
"password": null,
"port": null,
"provider": null,
"ssh_keyfile": null,
"state": "present",
"timeout": null,
"transport": null,
"username": null,
"vlan_id": 777
}
},
"msg": "ncclient timed out while waiting for an rpc reply."
}
任何帮助将不胜感激。
解决方案
一个人在这里为我提供了一个解决方案,我认为这可能会影响到你们中的更多人(https://www.reddit.com/r/ansible/comments/cq7joa/help_ncclient_timed_out_while_waiting_for_rpc/)
帮助我的实际上是一个建议,将我的 Ansible 服务器中的 ncclient 版本从 0.6.6 降低到 0.6.4,并将 ansible.cfg 中的超时值延长到至少 120。
所以我得救了。谢谢!
推荐阅读
- javascript - 如何使用 Jest 测试具有子组件的 Vue 组件
- spring - 处理连接错误 stomp 0.3.3 颤振/飞镖
- python - 使用 Selenium 或 Beautiful soap 滚动页面的替代方法?
- angular - Angular 2+ swtichMap 无法正常工作
- infinispan-9 - ISPN000373:尝试使用配置模板“XXXX”和 Infinispan 9.2.5 启动缓存
- angular - Angular Effects - 如何获得 100% 的测试结果(覆盖 funcs )?
- javascript - 为什么字符串中有加号?
- mysql - 什么存储合适
- node.js - 添加发布日期
- php - 在 ec2 AWS 上使用 mb_language PHP 发送电子邮件时出现错误 https 500