2015-11-04 153 views
2

我用Ubuntu 15.10運行計算機,我嘗試運行VagrantAnsibleAnsible:SSH錯誤:ControlPath太長

在開始之前,我想說我對服務器管理並不瞭解,尤其是Ansible

我要以這種方式運行我的系統的原因是因爲我已開始處理需要此安裝的項目。

畢竟,我的問題是,雖然置備Vagrant我收到以下消息

<aaa.dev> ESTABLISH CONNECTION FOR USER: vagrant 
<aaa.dev> REMOTE_MODULE setup 
<aaa.dev> EXEC ssh -C -tt -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile=/media/merianos/Large Internal/Vagrant/ansible-project/.vagrant/machines/default/virtualbox/private_key -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/merianos/.ansible/cp/%h-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 aaa.dev /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1446622406.54-199921739516776 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1446622406.54-199921739516776 && echo $HOME/.ansible/tmp/ansible-tmp-1446622406.54-199921739516776' 
fatal: [aaa.dev] => SSH Error: ControlPath too long 
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue. 

那麼,是不是更多鈔票來幫助我的人有這個問題?

只是說,我有嘗試這篇文章:https://github.com/ansible/ansible/issues/11536和我在ansible.cfgcontrol_path = %(directory)s/%%h-%%r但仍無法正常工作改變了control_path

注意我的安裝路徑包含一個空間,我無法刪除它,因爲在同一個硬盤上運行了許多其他項目,並且配置對於所有項目都是巨大的。我不知道這個空間是否是問題,但我只說了一下。

更新#1

結果之前,我改變什麼:

<aaa.dev> ESTABLISH CONNECTION FOR USER: vagrant 
<aaa.dev> REMOTE_MODULE setup 
<aaa.dev> EXEC ssh -C -tt -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile=/media/merianos/Large Internal/Vagrant/ansible-project/.vagrant/machines/default/virtualbox/private_key -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/merianos/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 aaa.dev /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1446628138.53-155680153347939 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1446628138.53-155680153347939 && echo $HOME/.ansible/tmp/ansible-tmp-1446628138.53-155680153347939' 
fatal: [aaa.dev] => SSH Error: ControlPath too long 
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue. 

結果與control_path = %(directory)s/%%h-%%r

<aaa.dev> ESTABLISH CONNECTION FOR USER: vagrant 
<aaa.dev> REMOTE_MODULE setup 
<aaa.dev> EXEC ssh -C -tt -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile=/media/merianos/Large Internal/Vagrant/ansible-project/.vagrant/machines/default/virtualbox/private_key -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/merianos/.ansible/cp/%h-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 aaa.dev /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1446628320.4-231606404275563 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1446628320.4-231606404275563 && echo $HOME/.ansible/tmp/ansible-tmp-1446628320.4-231606404275563' 
fatal: [aaa.dev] => SSH Error: ControlPath too long 
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue. 

更新#2

後,我設置ssh_args = -o ControlMaster=off我得到以下結果:

<aaa.dev> ESTABLISH CONNECTION FOR USER: vagrant 
<aaa.dev> REMOTE_MODULE setup 
<aaa.dev> EXEC ssh -C -tt -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile=/media/merianos/Large Internal/Vagrant/ansible-project/.vagrant/machines/default/virtualbox/private_key -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/merianos/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 aaa.dev /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1446628489.4-10074395967553 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1446628489.4-10074395967553 && echo $HOME/.ansible/tmp/ansible-tmp-1446628489.4-10074395967553' 
fatal: [aaa.dev] => SSH Error: ControlPath too long 
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue. 

一般爲每修改我做到了,錯誤消息似乎是相同的,也許配置它從其他層面發生,但不是ansible.cfg

可惜的是,我不知道在哪裏可以找到的位置:(

回答

3

similar question所描述的問題。

你需要改變它的東西更短的(如果你有很長的主機名)。爲了測試如果您只能嘗試./master,但對於實際使用情況,您至少應該使用./s/%%h-%%r

+0

謝謝你的回答,但你能幫我嗎?我不知道在哪裏改變這個變量。正如我在我的問題中所描述的那樣,我在ansible.cfg中更改了control_path,但沒有奏效。任何想法如何改變它?謝謝 –

+0

'not-working'是什麼意思?它在輸出消息中沒有任何區別?設置'ssh_args = -o ControlMaster = off'有什麼區別? – Jakuje

+0

在哪裏更改ControlMaster?正如我所說我沒有經驗的服務器管理員,我不知道Ansible如何工作,以及如何配置它。經過長時間的研究,我發現'ansible.cfg'並改變了'control_path'屬性,但我不知道如何應用你的提示。對不起,那個 –

1

在Ansible的documentation for OpenSSH specific settings的第一句話說:

Under the [ssh_connection] header, the following settings are tunable for SSH connections.

所以,你需要的ssh_args變量存放在ansible.cfg[ssh_connection]部分,例如:

[defaults] 
timeout = 600 

[ssh_connection] 
ssh_args = -o ControlMaster=off 

事實上壓倒一切具有空值的ssh_args會禁用Ansible中的ControlMaster/ControlPersistent/ControlPath的默認值,所以它應該只是簡單地是:

[ssh_connection] 
ssh_args =