Ansible在远程节点上失败基本回声

时间:2014-09-23 12:04:29

标签: ansible

我正在测试Ansible,看看它是否可以为我们的嵌入式环境中的更新系统提供可行的后端。我完全没有问题。

我有两台机器,通过以太网连接,可以通过ssh相互通信。两者都有python 2.7,openssh作为ssh客户端并运行ssh服务器。两者都有ssh-key身份验证。我可以从控制机器ssh到另一台机器并在那里调用python而没有任何问题。 Ansible可以在本地机器上运行,但是根本无法操作rmeote机器。

使用此主机文件:

localhost              ansible_connection=local
192.168.100.212        ansible_connection=ssh ansible_ssh_private_key_file=~/.ssh/id_rsa

电话

ansible all -a "echo Hello World!"

失败,显示以下消息:

localhost | success | rc=0 >>
Hello World!

192.168.100.212 | FAILED => Traceback (most recent call last):
File "/media/ext-1/python/lib/python2.7/site-packages/ansible-1.8-py2.7.egg/ansible/runner/__init__.py", line 568, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File "/media/ext-1/python/lib/python2.7/site-packages/ansible-1.8-py2.7.egg/ansible/runner/__init__.py", line 708, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File "/media/ext-1/python/lib/python2.7/site-packages/ansible-1.8-py2.7.egg/ansible/runner/__init__.py", line 937, in _executor_internal_inner
result = handler.run(conn, tmp, module_name, module_args, inject, complex_args)
File "/media/ext-1/python/lib/python2.7/site-packages/ansible-1.8-py2.7.egg/ansible/runner/action_plugins/normal.py", line 57, in run
return self.runner._execute_module(conn, tmp, module_name, module_args, inject=inject, complex_args=complex_args)
File "/media/ext-1/python/lib/python2.7/site-packages/ansible-1.8-py2.7.egg/ansible/runner/__init__.py", line 463, in _execute_module
self._transfer_str(conn, tmp, module_name, module_data)
File "/media/ext-1/python/lib/python2.7/site-packages/ansible-1.8-py2.7.egg/ansible/runner/__init__.py", line 294, in _transfer_str
conn.put_file(afile, remote)
File "/media/ext-1/python/lib/python2.7/site-packages/ansible-1.8-py2.7.egg/ansible/runner/connection_plugins/ssh.py", line 395, in put_file
(p, stdin) = self._run(cmd, indata)
File "/media/ext-1/python/lib/python2.7/site-packages/ansible-1.8-py2.7.egg/ansible/runner/connection_plugins/ssh.py", line 107, in _run
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/media/ext-1/python/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/media/ext-1/python/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

我无法确定导致此问题的原因。我已经测试了一个更广泛的playbook,它在localhost上执行整个操作没有问题,但在远程机器上使用相同的stascktrace失败。

2 个答案:

答案 0 :(得分:1)

管理发现它是由于缺少sftp客户端,配置它与scp一起工作就行了。

答案 1 :(得分:0)

试试这个,它应该有效!

$ ssh-copy-id -i /home/(*UserName*)/.ssh/id_rsa.pub (*dest: hostname/IPADDR*)