title: Permission denied when running Ansible ad hoc command
body: <p>I'm trying to run an Ansible ad hoc command via SSH on a Ubuntu 14 LTS server:</p>
  
  <pre><code>ansible all -m ping -u myusername
  </code></pre>
  
  <p>However I get the following error message:</p>
  
  <blockquote>
    <p>FAILED => SSH Error: Permission denied (publickey,password)</p>
  </blockquote>
  
  <p>When I try to run the ad command with the flag for asking a password, it works:</p>
  
  <pre><code>ansible all -m ping -u myusername --ask-pass
  
  absence.ugent.be | success &gt;&gt; {
  "changed": false,
  "ping": "pong"
  }
  </code></pre>
  
  <p>Does anyone know why the command doesn't work without asking for my password? And how I can solve this?</p>
  
  <p>update: as neuhaus suggested, I tried to remove the pass phrase from my ssh keyfile with:</p>
  
  <pre><code>ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
  </code></pre>
  
  <p>But that didn't fix it. The odd thing is that I can still successfully run</p>
  
  <pre><code>ansible all -m ping -u myusername --ask-pass
  </code></pre>
  
  <p>with my old pass phrase, even after creating a new ssh key.</p>
  
  <p>Thanks for your help,<br>
  Anthony</p>