Closed slientup closed 6 years ago
通过日志查看报如下错误,在unable to load cliconf for network_os ce 我再cliconf目录下也没有找到ce.py 2017-12-09 11:52:39,570 p=1216 u=root | loaded terminal plugin for network_os ce unable to load cliconf for network_os ce
请确定设备可以通过ssh方式登录。
同时,请提供下版本信息。 1)ansible版本 2)ce库版本(或从哪获取)?
从现象上来看,这个是ansible新增加的处理逻辑,只在ansible 2.5(开发分支devel)中有。请使用发布release版本。
ssh可以登录,从日志就可以看出, ansible的版本是ansible 2.4.2.0 通过pip管道安装的,CE库的版本是直接集成在ansible2.4.2.0里面的并没有单独安装,
相关日志:
2017-12-09 11:45:04,398 p=1195 u=root | connecting to host 192.168.1.108 returned an error
2017-12-09 11:45:04,398 p=1195 u=root | timed out
2017-12-09 11:52:38,270 p=1216 u=root | creating new control socket for host 192.168.1.108:22 as user admin123
2017-12-09 11:52:38,271 p=1216 u=root | control socket path is /root/.ansible/pc/90d67a59a6
2017-12-09 11:52:38,271 p=1216 u=root | current working directory is /
2017-12-09 11:52:38,271 p=1216 u=root | using connection plugin network_cli
2017-12-09 11:52:38,527 paramiko.transport starting thread (client mode): 0x2331290L
2017-12-09 11:52:38,528 paramiko.transport Local version/idstring: SSH-2.0-paramiko_2.1.1
2017-12-09 11:52:38,750 paramiko.transport Remote version/idstring: SSH-2.0--
2017-12-09 11:52:38,751 paramiko.transport Connected (version 2.0, client -)
2017-12-09 11:52:38,755 paramiko.transport kex algos:[u'diffie-hellman-group1-sha1', u'ecdh-sha2-nistp521', u'ecdh-sha2-nistp384', u'ecdh-sha2-nistp256', u'diffie-hellman-group-exchange-sha256', u'diffie-hellman-group-exchange-sha1', u'sm2kep-sha2-nistp256'] server key:[u'ssh-dss', u'ssh-rsa', u'ecdsa-sha2-nistp521'] client encrypt:[u'aes256-ctr', u'aes128-ctr', u'aes256-cbc', u'aes128-cbc', u'blowfish-cbc', u'3des-cbc'] server encrypt:[u'aes256-ctr', u'aes128-ctr', u'aes256-cbc', u'aes128-cbc', u'blowfish-cbc', u'3des-cbc'] client mac:[u'hmac-sha2-256', u'hmac-sha2-256-96', u'hmac-sha1', u'hmac-sha1-96'] server mac:[u'hmac-sha2-256', u'hmac-sha2-256-96', u'hmac-sha1', u'hmac-sha1-96'] client compress:[u'none', u'zlib'] server compress:[u'none', u'zlib'] client lang:[u''] server lang:[u''] kex follows?False
2017-12-09 11:52:38,755 paramiko.transport Kex agreed: diffie-hellman-group1-sha1
2017-12-09 11:52:38,755 paramiko.transport Cipher agreed: aes128-ctr
2017-12-09 11:52:38,756 paramiko.transport MAC agreed: hmac-sha2-256
2017-12-09 11:52:38,756 paramiko.transport Compression agreed: none
2017-12-09 11:52:39,083 paramiko.transport kex engine KexGroup1 specified hash_algo
2017-12-09 11:52:49,606 paramiko.transport EOF in transport thread
在cliconf的目录下面有cisco操作系统的py文件,但是并没有看到我们华为 ce.py的文件 [root@localhost cliconf]# ll 总用量 96 -rw-r--r-- 1 root root 2670 11月 30 05:08 aireos.py -rw-r--r-- 1 root root 2971 12月 8 17:39 aireos.pyc -rw-r--r-- 1 root root 2656 11月 30 05:08 aruba.py -rw-r--r-- 1 root root 2949 12月 8 17:39 aruba.pyc -rw-r--r-- 1 root root 2546 11月 30 05:08 asa.py -rw-r--r-- 1 root root 2876 12月 8 17:39 asa.pyc -rw-r--r-- 1 root root 2385 11月 30 05:08 eos.py -rw-r--r-- 1 root root 2663 12月 8 17:39 eos.pyc -rw-r--r-- 1 root root 8340 11月 30 05:08 init.py -rw-r--r-- 1 root root 9950 12月 8 17:39 init.pyc -rw-r--r-- 1 root root 2544 11月 30 05:08 ios.py -rw-r--r-- 1 root root 2874 12月 8 17:39 ios.pyc -rw-r--r-- 1 root root 2900 11月 30 05:08 iosxr.py -rw-r--r-- 1 root root 3430 12月 8 17:39 iosxr.pyc -rw-r--r-- 1 root root 2991 11月 30 05:08 junos.py -rw-r--r-- 1 root root 3721 12月 8 17:39 junos.pyc -rw-r--r-- 1 root root 2052 11月 30 05:08 nxos.py -rw-r--r-- 1 root root 2427 12月 8 17:39 nxos.pyc -rw-r--r-- 1 root root 2529 11月 30 05:08 vyos.py -rw-r--r-- 1 root root 3111 12月 8 17:39 vyos.pyc
这个有个已知问题,把这个pull request的改动(2行)直接更新到你的环境,手动改下,当前这个PR还没合入。 https://github.com/ansible/ansible/pull/33732/files
确定了,这个是新的机制,还没适配。
那我添加这两行能实现访问吗?
display.vvv('using connection plugin %s' % pc.connection, pc.remote_addr)
connection = self._shared_loader_obj.connection_loader.get('persistent', pc, sys.stdin)
我做了如下修改之后还是一样,请问是不是修改后还是不行,如果不行的话,能否推荐下可以成功的ansible版本和ce库的版本? 66 # password=pc.password, 67 # ssh_keyfile=pc.private_key_file 68 password=pc.password 69 ) 70 display.vvv('using connection plugin %s' % pc.connection, pc.remote_addr) 71 connection = self._shared_loader_obj.connection_loader.get('persistent', pc, sys.stdin)
91 self._task.args['transport'] = transport 92 self._task.args['provider'] = provider
@zhixiongzeng ,2.4.2.0的release版本修改ce.py后,我这试了是OK的啊 [root@SZV1000182092 ansible]# ansible -m ce_command -a 'host=10.134.124.254 port=6850 username=client001 password=Admin@123 commands="display version"' localhost --connection local -vvvv ansible 2.4.2.0 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible-2.4.2.0-py2.7.egg/ansible executable location = /usr/bin/ansible python version = 2.7.5 (default, Sep 15 2016, 22:37:39) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] Using /etc/ansible/ansible.cfg as config file setting up inventory plugins Set default localhost to localhost Parsed /etc/ansible/hosts inventory source with ini plugin [WARNING]: Found both group and host with same name: localhost
Loading callback plugin minimal of type stdout, v2.0 from /usr/lib/python2.7/site-packages/ansible-2.4.2.0-py2.7.egg/ansible/plugins/callback/init.pyc META: ran handlers
我这边再试后,依然是那个错误。 2018-03-06 18:16:46,664 p=8607 u=root | ssh connection done, setting terminal 2018-03-06 18:16:46,666 paramiko.transport [chan 0] Max packet in: 32768 bytes 2018-03-06 18:16:46,674 paramiko.transport [chan 0] Max packet out: 32768 bytes 2018-03-06 18:16:46,675 paramiko.transport Secsh channel 0 opened. 2018-03-06 18:16:46,682 paramiko.transport [chan 0] Sesch channel 0 request ok 2018-03-06 18:16:46,692 paramiko.transport [chan 0] Sesch channel 0 request ok 2018-03-06 18:16:46,702 p=8607 u=root | loaded terminal plugin for network_os ce unable to load cliconf for network_os ce 2018-03-06 18:16:46,707 p=8607 u=root | unable to load cliconf for network_os ce 2018-03-06 18:16:55,534 p=8596 u=root | localhost | FAILED! => { "changed": false, "msg": "unable to open shell. Please see: https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell" } 2018-03-06 18:16:56,709 p=8607 u=root | failed to create control socket for host 172.16.255.1 2018-03-06 18:16:56,712 p=8607 u=root | Traceback (most recent call last):
能否远程支持帮忙看下?
可以,您告诉我下时间,和方式,邮件发我下,或者微信等联系方式
我什么时候都可以,微信号18780106305 谢谢
已经联系处理,问题闭环。
ansible -m ce_command -a 'host=192.168.1.5 port=22 username=admin@123 password=Huawei@123456 commands="display version"' localhost --connection local -vvvv 执行该命令的时候报raise socket.timeout() An exception occurred during task execution. The full traceback is: Traceback (most recent call last): File "/tmp/ansible_un2ETe/ansible_module_ce_command.py", line 263, in
main()
File "/tmp/ansible_un2ETe/ansible_module_ce_command.py", line 199, in main
supports_check_mode=True)
File "/tmp/ansible_un2ETe/ansible_modlib.zip/ansible/module_utils/network.py", line 112, in init
File "/tmp/ansible_un2ETe/ansible_modlib.zip/ansible/module_utils/network.py", line 148, in connect
File "/tmp/ansible_un2ETe/ansible_modlib.zip/ansible/module_utils/cloudengine.py", line 243, in connect
File "/tmp/ansible_un2ETe/ansible_modlib.zip/ansible/module_utils/shell.py", line 226, in connect
File "/tmp/ansible_un2ETe/ansible_modlib.zip/ansible/module_utils/shell.py", line 116, in open
File "/tmp/ansible_un2ETe/ansible_modlib.zip/ansible/module_utils/shell.py", line 128, in receive
File "/usr/lib/python2.7/site-packages/paramiko/channel.py", line 667, in recv
socket.timeout
localhost | FAILED! => { "changed": false, "failed": true, "invocation": { "module_name": "ce_command" }, "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_un2ETe/ansible_module_ce_command.py\", line 263, in\n main()\n File \"/tmp/ansible_un2ETe/ansible_module_ce_command.py\", line 199, in main\n supports_check_mode=True)\n File \"/tmp/ansible_un2ETe/ansible_modlib.zip/ansible/module_utils/network.py\", line 112, in init\n File \"/tmp/ansible_un2ETe/ansible_modlib.zip/ansible/module_utils/network.py\", line 148, in connect\n File \"/tmp/ansible_un2ETe/ansible_modlib.zip/ansible/module_utils/cloudengine.py\", line 243, in connect\n File \"/tmp/ansible_un2ETe/ansible_modlib.zip/ansible/module_utils/shell.py\", line 226, in connect\n File \"/tmp/ansible_un2ETe/ansible_modlib.zip/ansible/module_utils/shell.py\", line 116, in open\n File \"/tmp/ansible_un2ETe/ansible_modlib.zip/ansible/module_utils/shell.py\", line 128, in receive\n File \"/usr/lib/python2.7/site-packages/paramiko/channel.py\", line 667, in recv\n raise socket.timeout()\nsocket.timeout\n",
"module_stdout": "",
"msg": "MODULE FAILURE"