title: Ansible can't ping my vagrant box with the vagrant insecure public key
body: <p>I'm using Ansible 2.4.1.0 and Vagrant 2.0.1 with VirtualBox on osx and although provisioning of my vagrant box works fine with ansible, I get an unreachable error when I try to ping with:</p>
  
  <pre><code>➜  ansible all -m ping
  vagrant_django | UNREACHABLE! =&gt; {
      "changed": false, 
      "msg": "Failed to connect to the host via ssh: Permission denied (publickey,password).\r\n", 
      "unreachable": true
  }
  </code></pre>
  
  <p>The solutions offered on similar questions didn't work for me (like adding the vagrant insecure pub key to my ansible config). I just <strong>can't</strong> get it to work with the vagrant insecure public key.</p>
  
  <p>Fwiw, here's my ansible.cfg file:</p>
  
  <pre><code>[defaults]
  host_key_checking = False
  inventory = ./ansible/hosts
  roles_path = ./ansible/roles
  private_key_file = ~/.vagrant.d/insecure_private_key
  </code></pre>
  
  <p>And here's my ansible/hosts file (ansible inventory):</p>
  
  <pre><code>[vagrantboxes]
  vagrant_vm ansible_ssh_user=vagrant ansible_ssh_host=192.168.10.100 ansible_ssh_port=22 ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key
  </code></pre>
  
  <p>What <strong>did</strong> work was using my own SSH public key. When I add this to the authorized_keys on my vagrant box, I can ansible ping:</p>
  
  <pre><code>➜  ansible all -m ping       
  vagrant_django | SUCCESS =&gt; {
      "changed": false, 
      "failed": false, 
      "ping": "pong"
  }
  </code></pre>
  
  <p>I can't connect via ssh either, so that seems to be the underlying problem. Which is fixed by adding my own pub key to the vagrant box in authorized_hosts. </p>
  
  <p>I'd love to know <strong>why</strong> it doesn't work with the vagrant insecure key. Does anyone know?</p>
  
  <p>PS: To clarify, although the root cause is similar to <a href="https://stackoverflow.com/questions/28471542/cant-ssh-to-vagrant-vms-using-the-insecure-private-key-vagrant-1-7-2">this other question</a>, the symptoms and context are different. I could provision my box with ansible, but couldn't ansible ping it. This justifies another question imho. </p>