title: How to run an ansible-playbook with a passphrase-protected-ssh-private-key?
body: <p>I have created an autoscaling group for Amazon <code>EC2</code> and I have added my public key when I created the AMI with <code>packer</code>, I can run ansible-playbook and ssh to the hosts.</p>
  <p>But there is a problem when I run the playbook like this
  <code>ansible-playbook load.yml</code> I am getting this message that I need to write my password</p>
  <blockquote>
  <p>Enter passphrase for key '/Users/XXX/.ssh/id_rsa':<br />
  Enter passphrase
  for key '/Users/XXX/.ssh/id_rsa':<br />
  Enter passphrase for key
  '/Users/XXX/.ssh/id_rsa':</p>
  </blockquote>
  <p>The problem is it doesn't accept my password (I am sure I am typing my password correctly).</p>
  <p>I found that I can send my password with <code>ask-pass</code> flag,  so I have changed my command to <code> ansible-playbook load.yml --ask-pass</code> and I got some progress but again for some other task it asks for the password again and it didn't accept my password</p>
  <pre><code>[WARNING]: Unable to parse /etc/ansible/hosts as an inventory source
  
   [WARNING]: No inventory was parsed, only implicit localhost is available
  
   [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
  
  
  PLAY [localhost] *************************************************************************************************************
  
  TASK [ec2_instance_facts] ****************************************************************************************************
  ok: [localhost]
  
  TASK [add_host] **************************************************************************************************************
  changed: [localhost] =&gt; (item=xx.xxx.xx.xxx)
  changed: [localhost] =&gt; (item=yy.yyy.yyy.yyy)
  
  PLAY [instances] *************************************************************************************************************
  
  TASK [Copy gatling.conf] *****************************************************************************************************
  ok: [xx.xxx.xx.xxx]
  ok: [yy.yyy.yyy.yyy]
  Enter passphrase for key '/Users/ccc/.ssh/id_rsa': Enter passphrase for key '/Users/ccc/.ssh/id_rsa':
  Enter passphrase for key '/Users/ccc/.ssh/id_rsa':
  Enter passphrase for key '/Users/ccc/.ssh/id_rsa':
  Enter passphrase for key '/Users/ccc/.ssh/id_rsa':
  </code></pre>
  <p>If I don't use <code>ask-pass</code> flag even the task <code>[Copy gatling.conf]</code> doesn't complete and complaining about could not access the hosts. By adding the flag this part passes, but my next task again asks for pass.</p>
  <p>How should I solve this issue? What am I doing wrong here?</p>