AnsiblePlaybook Jenkins Pipeline
<p>I succeeded so fare to run ansiblePlaybook in a Job DSL script:</p>

<pre><code>ansiblePlaybook("running-colour.yml") {
      inventoryPath("ec2.py")
      additionalParameters("--vault-password-file \$ANSIBLE_VAULT_KEY_FILE -e env_name=\$ENVIRONMENT_NAME")
}
</code></pre>

<p>But when I run the very same params in the Pipeline:</p>

<pre><code>ansiblePlaybook playbook: 'running-colour.yml', inventory: 'ec2.py', extras: "-e env_name=$environment --vault-password-file $ansibleVaultKeyFile"
</code></pre>

<p>It would give me this error that doesn't tell me what is wrong:</p>

<pre><code>ansible-playbook running-colour.yml -i ec2.py -f 5 -e env_name=prod --vault-password-file **** 
FATAL: command execution failed
hudson.AbortException: Ansible playbook execution failed
    at org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder.perform(AnsiblePlaybookBuilder.java:227)
    at org.jenkinsci.plugins.ansible.workflow.AnsiblePlaybookStep$AnsiblePlaybookExecution.run(AnsiblePlaybookStep.java:290)
    at org.jenkinsci.plugins.ansible.workflow.AnsiblePlaybookStep$AnsiblePlaybookExecution.run(AnsiblePlaybookStep.java:226)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:52)
    at hudson.security.ACL.impersonate(ACL.java:221)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:49)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
</code></pre>

<p>So I tried to run the command printed as failing in a <code>sh</code> step:</p>

<pre><code>sh "ansible-playbook running-colour.yml -i ec2.py -f 5 -e env_name=prod --vault-password-file $file"
</code></pre>

<p>And it works!</p>