attempt to ansible -m ping into vagrant box fails

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

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)

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 )

  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