我一直在试图在我建立的Vagrant盒子上使用我的YML文件,这是CentOS。但是,我遇到了这个超时在所有时间:Ansag超时Vagrant
[email protected]:~/Desktop/vagrant$ vagrant provision
[default] Running provisioner: ansible...
PLAY [Show off some basic Ansible features] ***********************************
GATHERING FACTS ***************************************************************
<10.0.x.x> ESTABLISH CONNECTION FOR USER: vagrant
<10.0.x.x> REMOTE_MODULE setup
<10.0.x.x> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/ryan/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=2222', '-o', 'IdentityFile=/home/ryan/.vagrant.d/insecure_private_key', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=vagrant', '-o', 'ConnectTimeout=10', '10.0.x.x', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1441243799.45-82681900071220 && echo $HOME/.ansible/tmp/ansible-tmp-1441243799.45-82681900071220'"]
fatal: [default] => SSH encountered an unknown error. The output was:
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /home/ryan/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: auto-mux: Trying existing master
debug1: Control socket "/home/ryan/.ansible/cp/ansible-ssh-10.0.x.x-2222-vagrant" does not exist
debug2: ssh_connect: needpriv 0
debug1: Connecting to 10.0.x.x [10.0.x.x] port 2222.
debug2: fd 3 setting O_NONBLOCK
debug1: connect to address 10.0.x.x port 2222: Connection timed out
ssh: connect to host 10.0.x.x port 2222: Connection timed out
TASK: [common | Install postgres] *********************************************
FATAL: no hosts matched or all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/home/ryan/site.retry
default : ok=0 changed=0 unreachable=1 failed=0
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
我期待所有在互联网上找出原因,它不断超时又上来什么都没有,所以我要求计算器用于任何类型的建议。这里是我的VagrantFile样子:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "cento"
config.vm.provision "ansible" do |ansible|
ansible.groups = {
"vagrant" => ["10.0.x.x"]
}
ansible.extra_vars = { ansible_ssh_user: "vagrant" }
ansible.sudo = true
ansible.verbose = "vvvv"
ansible.playbook = "site.yml"
ansible.inventory_path = "hosts"
end
end
而我的主机文件我使用:
[vagrant]
default ansible_ssh_host=10.0.x.x ansible_ssh_user=vagrant ansible_ssh_port=2222
有没有人有,为什么当我运行vagrant provision
任何理由,超时我?
更新: 我刚才使用默认的流浪汉主机文件的尝试:
Generated by Vagrant
default ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222
有没有办法从环回地址更改默认ansible_ssh_host到它的实际的IP?
如果使用ansible_ssh_port = 22而不是2222连接到10.0.x.x,会发生什么情况?当Vagrant配置环回地址时,它会设置端口转发,但仅在127.0.0.1上设置,而不是在真实IP上。 – nikobelia
它仍然超时。我试过连接端口22和2222 – ryekayo
嗯。接下来要缩小的范围是,如果VM不在监听传入连接,或者您的凭证无法正常工作。 尝试使用'ssh -i〜/ .vagrant.d/insecure_private_key -p 2222 [email protected] -vvv'自己打开与主机的SSH连接,然后将输出与其他地址进行比较。 – nikobelia