title: Ansible "Failed to connect to host via ssh: Permission denied" when trying -m ping all
body: <p>I've been at this all morning, and I've seen multiple posts about this error in other places, but none of the solutions seem to be working for me at this point. </p>
  
  <p>I'm playing around with Ansible and trying to setup my inventory + hosts for this project. </p>
  
  <p>For my hosts file I have (/etc/ansible/hosts): </p>
  
  <pre><code>[test-servers]
  
  x.x.x.x
  </code></pre>
  
  <p>For my inventory I have (/etc/ansible/inventory.txt):</p>
  
  <pre><code>ansible-target ansible_ssh_host=x.x.x.x ansible_user=user ansible_ssh_pass=password
  </code></pre>
  
  <p>But when I try to run <code>ansible -m ping all</code> I get: </p>
  
  <pre><code>x.x.x.x | UNREACHABLE! =&gt; {
  "changed": false,
  "msg": Failed to connect to the host via ssh: user@x.x.x.x: Permission denied (publickey,password,keyboard-interacgive.\r\n"
  "unreachable":true
  }
  </code></pre>
  
  <p>However, I get a pong response successfully when I run:</p>
  
  <pre><code>ansible x.x.x.x -m ping -i /etc/ansible/inventory.txt
  </code></pre>
  
  <p>Anyone have any idea what this might be?</p>
  
  <p>Thanks in advance.</p>