title: My Ansible playbook doesn't run on Jenkins
body: <p>I have installed the Ansible plugin on Jenkins and set it up with my master instance which I have also installed Ansible and Jenkins on. However, I have an issue when I try to run my Ansible playbook in a Jenkins freestyle project. Can someone help me?</p>
  <p>Issue:</p>
  <pre><code>Running as SYSTEM
  Building in workspace /var/lib/jenkins/workspace/ansible-demo
  [ansible-demo] $ /usr/bin/ansible-playbook playbook/docker_playbook.yaml -f 5
  
  PLAY [webservers] **************************************************************
  
  TASK [Gathering Facts] *********************************************************
  fatal: [slave]: UNREACHABLE! =&gt; {&quot;changed&quot;: false, &quot;msg&quot;: &quot;Failed to connect to the host via ssh: ubuntu@172.31.95.143: Permission denied (publickey).&quot;, &quot;unreachable&quot;: true}
  
  PLAY RECAP *********************************************************************
  slave                      : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0   
  
  FATAL: command execution failed
  hudson.AbortException: Ansible playbook execution failed
      at org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder.perform(AnsiblePlaybookBuilder.java:262)
      at org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder.perform(AnsiblePlaybookBuilder.java:232)
      at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
      at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:79)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:816)
      at hudson.model.Build$BuildExecution.build(Build.java:199)
      at hudson.model.Build$BuildExecution.doRun(Build.java:164)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:524)
      at hudson.model.Run.execute(Run.java:1897)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
      at hudson.model.ResourceController.execute(ResourceController.java:101)
      at hudson.model.Executor.run(Executor.java:442)
  ERROR: Ansible playbook execution failed
  Finished: FAILURE
  </code></pre>
  <p>This is my host in the Ansible hosts file:</p>
  <pre><code>[webservers]
  slave ansible_ssh_host=ubuntu@172.31.95.143
  </code></pre>
  <p>I even set the path to my private key file in the ansible.cfg:</p>
  <pre><code>;private_key_file= ~/.ssh/id_rsa.pub
  </code></pre>