# vagrant and ansible not working on osx mountain lion

**URL:** <https://forum.ansible.com/t/vagrant-and-ansible-not-working-on-osx-mountain-lion/13528>\
**Category:** Ansible Project\
**Created:** [September 22, 2013, 7:39pm UTC](https://forum.ansible.com/t/vagrant-and-ansible-not-working-on-osx-mountain-lion/13528 "2013-09-22T19:39:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Derek\_Brockway](https://avatars.discourse-cdn.com/v4/letter/d/ba9def/32.png) [@Derek\_Brockway](https://forum.ansible.com/u/Derek_Brockway)\
**Post date:** [September 22, 2013, 7:39pm UTC](https://forum.ansible.com/t/vagrant-and-ansible-not-working-on-osx-mountain-lion/13528/1 "2013-09-22T19:39:03Z")

</div>

I’ve installed virtual box, vagrant and ansible from [http://www.pyrosoft.co.uk/blog/2012/06/26/installing-ansible-on-osx-lion/](http://www.pyrosoft.co.uk/blog/2012/06/26/installing-ansible-on-osx-lion/)

But I can’t get anything to work. I can start vagrant and ssh in but I can’t get to any urls.

I don’t have /etc/ansible/hosts, is this supposed to be created on install?

Running ansible all -m ping I get these errors

192.168.0.62 | FAILED =\> SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue

and with -vvvv

192.168.0.62 | FAILED =\> SSH encountered an unknown error. The output was:  
OpenSSH\_5.9p1, OpenSSL 0.9.8y 5 Feb 2013  
debug1: Reading configuration data /etc/ssh\_config  
debug1: /etc/ssh\_config line 20: Applying options for \*  
debug1: auto-mux: Trying existing master  
debug1: Control socket “/Users/Derek/.ansible/cp/ansible-ssh-192.168.0.62-22-Derek” does not exist  
debug2: ssh\_connect: needpriv 0  
debug1: Connecting to 192.168.0.62 [192.168.0.62] port 22.  
debug2: fd 3 setting O\_NONBLOCK  
debug1: connect to address 192.168.0.62 port 22: Operation timed out  
ssh: connect to host 192.168.0.62 port 22: Operation timed out

My vagrant file looks likem

Vagrant::Config.run do |config|  
config.vm.box = “lucid32”  
config.vm.forward\_port 80, 4567  
end

But when I got to localhost:4567 nothing shows (this webpage is not available)

I have a completely fresh install of mountain lion so nothing should be blocking anything.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [September 22, 2013, 7:54pm UTC](https://forum.ansible.com/t/vagrant-and-ansible-not-working-on-osx-mountain-lion/13528/2 "2013-09-22T19:54:17Z")

</div>

The vagrant support in Ansible isn’t actually part of Ansible, so I would recommend asking this question in the vagrant forum.

[http://www.vagrantup.com/support.html#community](http://www.vagrantup.com/support.html#community)

---

<div class="post-metadata">

**Author:** ![Walid](https://avatars.discourse-cdn.com/v4/letter/w/ea5d25/32.png) [@Walid](https://forum.ansible.com/u/Walid)\
**Post date:** [September 22, 2013, 9:17pm UTC](https://forum.ansible.com/t/vagrant-and-ansible-not-working-on-osx-mountain-lion/13528/3 "2013-09-22T21:17:27Z")

</div>

did you check using netstat or nmap that you have the port. you seem to be using the Vagrant version one config file " the older way" Vagrant site have good examples how to provision using Ansible , also try the gran the latest ansible as it has ssh trouble shooting, it will help you big time in diagnosing the connection issue.

---

<div class="post-metadata">

**Author:** ![Nick\_Groenen](https://avatars.discourse-cdn.com/v4/letter/n/c77e96/32.png) [@Nick\_Groenen](https://forum.ansible.com/u/Nick_Groenen)\
**Post date:** [September 23, 2013, 9:29am UTC](https://forum.ansible.com/t/vagrant-and-ansible-not-working-on-osx-mountain-lion/13528/4 "2013-09-23T09:29:41Z")

</div>

you don't yet fully grasp how Vagrant sets up networking and forwarded  
ports. Questions about that should be asked in Vagrant's forum  
obviously, as Michael pointed out, however what I recommend is to  
assign a private network [1] (called a host-only network in the  
version 1 config) to your Vagrant machines, and pointing Ansible at  
those IPs. The advantage of this is that if you have multiple VM's,  
they can easily reach each other as well.

I decided to put my Vagrant-related parts on GitHub [2], so feel free  
to use that as a starting point. It contains a few extra goodies such  
as adding the Vagrant machines to your local /etc/hosts for you as  
well.

[1]: [http://docs.vagrantup.com/v2/networking/private\_network.html](http://docs.vagrantup.com/v2/networking/private_network.html)  
[2]: [https://github.com/zoni/Vagrant-Ansible-example](https://github.com/zoni/Vagrant-Ansible-example)

---

<div class="post-metadata">

**Author:** ![Warren\_Strange](https://avatars.discourse-cdn.com/v4/letter/w/d78d45/32.png) [@Warren\_Strange](https://forum.ansible.com/u/Warren_Strange)\
**Post date:** [October 2, 2013, 11:59pm UTC](https://forum.ansible.com/t/vagrant-and-ansible-not-working-on-osx-mountain-lion/13528/5 "2013-10-02T23:59:27Z")

</div>

Derek - here is an example that might help you. It uses vagrant and ansible together. Check out the vagrant config file:

[https://github.com/wstrange/frstack](https://github.com/wstrange/frstack)
