2014-09-23 12 views
1

我目前正在測試Ansible,看看它是否可以爲嵌入式環境中的更新系統創建可行的後端。我有一個問題讓它充分發揮作用。Ansible在遠程節點上基本回應失敗

我有兩臺機器,它們通過以太網連接,並且可以通過ssh相互通信。兩者都有python 2.7,openssh作爲ssh客戶端並運行ssh服務器。兩者都有ssh密鑰認證。我可以從控制機器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 

我無法確定是什麼原因造成了這個問題。我已經測試了更廣泛的操作手冊,並且它在本地主機上執行整個事件沒有問題,但在遠程計算機上執行同樣的stascktrace失敗。

+1

未來,使用-vvvv可以獲得更多的調試/輸出。 – tedder42 2014-09-23 16:13:56

回答

1

管理層發現,這是由於缺乏一個sftp客戶端,配置它與scp一起工作的伎倆。

0

試試這個,它應該工作!

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