title: Ansible permission problems
body: <p>I have seen this a lot on this forum but none of the answers have helped me.</p>
  
  <p>I am trying to run an ansible playbook, this worked fine on my Debian PC. Now I have moved to Ubuntu 16.04 it's not working. I get permission denied public key errors.</p>
  
  <p>I am assuming this is because I am running sudo ansible-playbook. </p>
  
  <p>This would then try to use the public key from my root user which is not on the servers I am trying to ansible.</p>
  
  <p>How do I run an ansible-playbook as sudo but use the ssh keys from my current user?</p>
  
  <p>If I run as sudo I get</p>
  
  <pre><code>fatal: [10.11.8.1]: UNREACHABLE! =&gt; {"changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey).\r\n", "unreachable": true}
  </code></pre>
  
  <p>If I don't run as sudo I get</p>
  
  <pre><code>fatal: [10.11.8.1]: FAILED! =&gt; {"failed": true, "msg": "Cannot write to ControlPath /home/chrisl/.ansible/cp"}
  </code></pre>
  
  <p>[WARNING]: Could not create retry file '/home/chrisl/ansible/keys.retry'.
  [Errno 13] Permission denied: u'/home/chrisl/ansible/keys.retry'</p>
  
  <p>I have also tried this and you can see what happens....</p>
  
  <p><img src="https://i.stack.imgur.com/CRlKh.png" alt="Picture Here with errors"></p>