title: Error running ansible-playbook using Jenkins
body: <p>I am getting the below error when I run an ansible playbook using Jenkins.</p>
  
  <p><code>Java.io.IOException: Cannot run program "/usr/bin/ansible-playbook" (in directory "/var/jenkins_home/workspace/ans"): error=2, No such file or directory</code> "</p>
  
  <p>This is what I have in my Jenkinsfile</p>
  
  <pre><code>pipeline {
       agent any
       environment {
          PATH = "/usr/bin/ansible:/usr/bin/ansible-playbook:$PATH"
          ANS_HOME = tool('ansible')
       }
       stages {
           stage('Example') {
               steps {
                   echo "PATH is: $ANS_HOME"
                   sh "whoami"
                   sh "echo $PATH"
                   sh "/usr/bin/ansible-playbook -i /path /to/myinventory.ini /path/to/playbooks/myplaybook.yml --extra-vars '{\"mode\" : \"running\"}'"
               }
           }
       }
  }
  </code></pre>
  
  <p>It is being run as a root user as my output from sh "whoami" is root .Also path has /usr/bin , /usr/bin/ansible and /usr/bin/ansible-playbook</p>
  
  <p>--------output below ---------------------------------------</p>
  
  <pre><code>&gt; [Pipeline] {
  &gt;     [Pipeline] stage
  &gt;     [Pipeline] { (Example)
  &gt;     [Pipeline] echo
  &gt;     PATH is: /usr/bin/
  &gt;     [Pipeline] sh
  &gt;     [t_AWS-DB-resource-scheduler-TM5AGTEATY6FDJ7IENKWVPBZAIMOHYN5WXTFRS72TMHS4V4L57UA]
  &gt; Running shell script
  &gt;     ps: unrecognized option: p
  &gt;     + whoami
  &gt;     root
  &gt;     [Pipeline] sh
  &gt;     [t_AWS-DB-resource-scheduler-TM5AGTEATY6FDJ7IENKWVPBZAIMOHYN5WXTFRS72TMHS4V4L57UA]
  &gt; Running shell script
  &gt;     ps: unrecognized option: p
  &gt;     + echo /usr/bin/ansible:/usr/bin/ansible-playbook:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
  &gt;     /usr/bin/ansible:/usr/bin/ansible-playbook:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin
  &gt;     [Pipeline] sh
  &gt;     [t_AWS-DB-resource-scheduler-TM5AGTEATY6FDJ7IENKWVPBZAIMOHYN5WXTFRS72TMHS4V4L57UA]
  &gt; Running shell script
  &gt;     ps: unrecognized option: p
  &gt;       -o COL1,COL2=HEADER Select columns for display
  &gt;     + /usr/bin/ansible-playbook -i /mnt/management/environments/localhost.ini
  &gt; /mnt/management/playbooks/utilities/aws-scheduler.yml --extra-vars
  &gt; {"mode" : "running"}
  &gt;     /var/jenkins_home/workspace/t_AWS-DB-resource-scheduler-TM5AGTEATY6FDJ7IENKWVPBZAIMOHYN5WXTFRS72TMHS4V4L57UA@tmp/durable-ae31d6ed/script.sh:
  &gt; line 1: /usr/bin/ansible-playbook: not found
  </code></pre>