I'm trying to use the ansible plugin in a pipeline script, but it fails to find ansible-playbook. I've used the "ansibleName" parameter to supply the name of the Ansible version I want to use from Jenkins' global tool config page, but it still fails. I get the following when trying to execute a playbook from a pipeline:
[workspace] $ ansible-playbook /opt/ansible-data/playbooks/client_deploy.yml > -i /opt/ansible-data/inventory/prod/ -f 5 --private-key > "/var/jenkins_home/jobs/Default/jobs/Client > deploy/workspace/ssh7766033036773514652.key" > -u ubuntu -e wl_name=default -e client_version=761c6f24 > > FATAL: command execution failed > java.io.IOException: Cannot run program "ansible-playbook" (in directory > "/var/jenkins_home/jobs/Default/jobs/Client deploy/workspace"): error=2, > No such file or directory > > The path to the ansible binaries has been defined in the global config page as /opt/ansible/ansible-2.2/bin, and this works for normal jenkins (ie. not pipeline) jobs, using the "Invoke Ansible playbook" build task. The ansible call from my Jenkinsfile is as follows: ansiblePlaybook( ansibleName: 'stable-2.2', playbook: "${ANSIBLE_DATA_PATH}/playbooks/client_deploy.yml", inventory: "${ANSIBLE_DATA_PATH}/inventory/${ENVIRONMENT}/", credentialsId: '574fb47c-33df-4096-bd0c-0c44962b2546', extraVars: [ wl_name: "${wlName}", client_version: "${gtpCommitId}" ], additionalParameters: '--vault-password-file "/var/jenkins_home/.ansible/vault.pwd" --forks=10', colorized: true ) "stable-2.2" is the name I've given to the version of Ansible defined on the global tools config page. Does anyone know why this isn't working? Thanks, Guy -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CANNH9mtaJBJjRzh0GgEd7o6K36QnFDdt2UccozP92S6urb6BTw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.