# attempt to ansible -m ping into vagrant box fails

**URL:** <https://forum.ansible.com/t/attempt-to-ansible-m-ping-into-vagrant-box-fails/19356>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [September 25, 2015, 1:35pm UTC](https://forum.ansible.com/t/attempt-to-ansible-m-ping-into-vagrant-box-fails/19356 "2015-09-25T13:35:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [September 25, 2015, 1:35pm UTC](https://forum.ansible.com/t/attempt-to-ansible-m-ping-into-vagrant-box-fails/19356/1 "2015-09-25T13:35:15Z")

</div>

what do you see when you rerun with ‘-vvvv’ as the error suggests?

---

<div class="post-metadata">

**Author:** ![DEBORAH\_AKUOKO](https://avatars.discourse-cdn.com/v4/letter/d/df705f/32.png) [@DEBORAH\_AKUOKO](https://forum.ansible.com/u/DEBORAH_AKUOKO)\
**Post date:** [September 25, 2015, 1:50pm UTC](https://forum.ansible.com/t/attempt-to-ansible-m-ping-into-vagrant-box-fails/19356/2 "2015-09-25T13:50:32Z")

</div>

Hello Dick,

Please see attached the screenshot of what I get when i rerun with -vvv.  
I seem to get the same permission denied error, but this time with some extra details in blue font.

> **(attachments)**
>
> ![after rerun with - vvv.png](https://us1.discourse-cdn.com/ansible/original/2X/0/0ed022596e8166f09690fcfebd26120895b44e9e.png)

---

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [September 25, 2015, 4:04pm UTC](https://forum.ansible.com/t/attempt-to-ansible-m-ping-into-vagrant-box-fails/19356/3 "2015-09-25T16:04:02Z")

</div>

OK, so that shows you the exact SSH command Ansible is running for you.  
If you were to paste that blue text into a shell you’ll likely get the same error  
(could be an issue with the VM or your client side).

You didn’t say how you’re sshing into the VM, and it seems like you’re pushing up  
a pubkey beforehand. So it’s not an approach I’m familiar with.

That said we use Vagrant extensively, just to get started on building out a playbook.  
So a few pointers that may help.

1. in your Vagrantfile it’s worth setting “c.ssh.insert\_key = false” to stop Vagrant  
generating a new public key everytime the VM boots.  
This is down to a ‘feature’ they added to newer Vagrants  
(gory details at : [https://github.com/mitchellh/vagrant/pull/4707](https://github.com/mitchellh/vagrant/pull/4707) )

2. ‘vagrant ssh foo’ is generally not the same as ‘ssh vagrant@foo’ - seems like  
Vagrant uses a different interface to SSH in and provision things (this may  
just be images I’ve used but it’s really confusing if you aren’t aware)

3. With the c.ssh.insert\_key setting fixed as in 1., all you normally need is to  
set a couple of vars in your inventory so Ansible will use the key and user  
that Vagrant expects
