我在 Ubuntu 机器(18.04.2)中的 VM Workstation 15 Pro 中使用 Ansible 2.7.10,并尝试在 GNS3 中连接思科路由器(3700 软件(C3725-ADVIPSERVICESK9-M),版本 12.4(23))。
原始 ssh 正在从 Ubuntu 终端运行,但在尝试通过 ansible ping 模块进行 ping 时出现以下错误。
root@ubuntu:/etc/ansible# ansible Routers -m ping -u cisco -k -vvv
ansible 2.7.10
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/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
Using /etc/ansible/ansible.cfg as config file
SSH password:
/etc/ansible/hosts did not meet host_list requirements, check plugin documentation if this is unexpected
/etc/ansible/hosts did not meet script requirements, check plugin documentation if this is unexpected
Parsed /etc/ansible/hosts inventory source with ini plugin
META: ran handlers
<192.168.74.10> ESTABLISH SSH CONNECTION FOR USER: cisco
<192.168.74.10> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=no -o StrictHostKeyChecking=no -o User=cisco -o ConnectTimeout=10 192.168.74.10 '/bin/sh -c '"'"'echo ~cisco && sleep 0'"'"''
<192.168.74.10> (0, '\r\nLine has invalid autocommand "/bin/sh -c \'echo ~cisco && sleep 0\'"', '')
<192.168.74.10> ESTABLISH SSH CONNECTION FOR USER: cisco
<192.168.74.10> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=no -o StrictHostKeyChecking=no -o User=cisco -o ConnectTimeout=10 192.168.74.10 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'echo ~cisco && sleep 0'"'"'"'"'"'"'"'"'"/.ansible/tmp/ansible-tmp-1557556461.94-275071590111448 `" && echo ansible-tmp-1557556461.94-275071590111448="` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'echo ~cisco && sleep 0'"'"'"'"'"'"'"'"'"/.ansible/tmp/ansible-tmp-1557556461.94-275071590111448 `" ) && sleep 0'"'"''
<192.168.74.10> (0, '\r\nLine has invalid autocommand "/bin/sh -c \'( umask 77 && mkdir -p "` echo Line has invalid autocommand "/bin/sh -c \'"\'"\'echo ~cisco && sleep 0\'"\'"\'"/.ansible/tmp/ansible-tmp-1557556461.94-275071590111448 `" && echo ansible-tmp-1557556461.94-275071590111448="` echo Line has invalid auto"', '')
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/ping.py
<192.168.74.10> PUT /root/.ansible/tmp/ansible-local-82605nzIYYL/tmpRi045V TO "` echo Line has invalid auto"/AnsiballZ_ping.py
<192.168.74.10> SSH: EXEC sshpass -d9 scp -C -o ControlMaster=no -o StrictHostKeyChecking=no -o User=cisco -o ConnectTimeout=10 /root/.ansible/tmp/ansible-local-82605nzIYYL/tmpRi045V '[192.168.74.10]:'"'"'"` echo Line has invalid auto"/AnsiballZ_ping.py'"'"''
192.168.74.10 | FAILED! => {
"msg": "failed to transfer file to /root/.ansible/tmp/ansible-local-82605nzIYYL/tmpRi045V \"` echo Line has invalid auto\"/AnsiballZ_ping.py:\n\nAdministratively disabled.\n"
}
请指教。