我使用ansible来实现网络自动化。通常情况下,一切都很正常,但当尝试在特定的Juniper交换机上创建虚拟局域网时,我得到了ncclient timed out while waiting for an rpc reply错误。我使用junos_vlan模块。
我尝试延长ansible.cfg的超时时间,将ansible_connection从network_cli切换到netconf,等等,但都没有效果。
从服务器端或交换机端都能做些什么吗?
我读到一个人找到了编辑模块文件的变通方法:Ansible, Juniper CLI commands. Timeout Error?
我能用同样的方法达到预期的效果吗?
我使用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."
}任何帮助都将不胜感激。
发布于 2019-08-14 22:13:21
一个家伙在这里给了我一个解决方案,我想这可能会影响到你们更多的人(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。
所以我得救了。谢谢!
https://stackoverflow.com/questions/57097652
复制相似问题