Ansible + Vagrant with VirtualBox ssh error

I’ve just recently started using Ansible + Vagrant and I have a multi-machine Vagrant file which I’ve put in this pastebin

http://pastebin.com/91GLiJaD

When I run ‘vagrant up’ sometimes it works and other times I get errors. The error I get is below

fatal: [192.168.33.20] => SSH encountered an unknown error. The output was:
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/seth/.ssh/config
debug1: /Users/seth/.ssh/config line 8: Applying options for *
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 102: Applying options for *
debug1: auto-mux: Trying existing master
debug1: Control socket “/Users/seth/.ansible/cp/ansible-ssh-192.168.33.20-22-vagrant” does not exist
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.33.20 [192.168.33.20] port 22.
debug2: fd 3 setting O_NONBLOCK
debug1: connect to address 192.168.33.20 port 22: Operation timed out
ssh: connect to host 192.168.33.20 port 22: Operation timed out

TASK: [common | be sure ntp is installed] *************************************
FATAL: no hosts matched or all hosts have already failed – aborting

Any ideas what I am doing wrong?

I’ve found the same issue this morning:

  • ansible 1.4.1, and devel with at #91f903eabeddfa19552eb1d1b998297d99627e3d as well
  • Vagrant 1.4
  • host machine ubuntu 13.10 64,
  • guest machine ubuntu 12.04 64

It looks a bit nondeterministic, there are moments when vagrant up works just fine.

Sounds like there should be a bug filed in the provisioner to wait for the port

(This is not part of Ansible core)

– Michael