Error: ansible playbook from jenkins

1,458 views
Skip to first unread message

Narmada Karthika

unread,
May 3, 2023, 1:23:41 PM5/3/23
to Ansible Project
I am facing below problem with running ansible playbook from Jenkins. I specified the location where I have my ansible playbook and inventory file.

sshpass: Failed to run command: No such file or directory 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:81) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:21) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:808) 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:516) at hudson.model.Run.execute(Run.java:1889) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:100) at hudson.model.Executor.run(Executor.java:433) ERROR: Ansible playbook execution failed Finished: FAILURE

Dick Visser

unread,
May 3, 2023, 1:30:50 PM5/3/23
to ansible...@googlegroups.com
On Wed, 3 May 2023 at 19:23, Narmada Karthika <chitt...@gmail.com> wrote:

sshpass: Failed to run command: No such file or directory


This is the problem 




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:81) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:21) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:808) 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:516) at hudson.model.Run.execute(Run.java:1889) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:100) at hudson.model.Executor.run(Executor.java:433) ERROR: Ansible playbook execution failed Finished: FAILURE

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/42bd5af6-a9e3-40d7-9a76-9ab2c433d7efn%40googlegroups.com.
--
Sent from Gmail Mobile

Jorge Rúa

unread,
May 3, 2023, 1:31:04 PM5/3/23
to ansible...@googlegroups.com
sshpass: Failed to run command: No such file or directory. Is sshpass in the $PATH for the user running jenkins?

On Wed, May 3, 2023, 19:23 Narmada Karthika <chitt...@gmail.com> wrote:
I am facing below problem with running ansible playbook from Jenkins. I specified the location where I have my ansible playbook and inventory file.

sshpass: Failed to run command: No such file or directory 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:81) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:21) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:808) 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:516) at hudson.model.Run.execute(Run.java:1889) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:100) at hudson.model.Executor.run(Executor.java:433) ERROR: Ansible playbook execution failed Finished: FAILURE

--

Narmada Karthika

unread,
May 3, 2023, 1:41:22 PM5/3/23
to Ansible Project
Thanks for that, just to give little more background.
I have pointed to run the job on the same node where i have ansible installed and playbooks. And also the playbook to run on windows nodes.

Dick Visser

unread,
May 3, 2023, 1:54:08 PM5/3/23
to ansible...@googlegroups.com
Yes that may be but the problem is that sshpass is not available.
You need to fix that and then the playbook will run.
How that would work with your Jenkins is up to you (or Jenkins). 

Narmada Karthika

unread,
May 3, 2023, 6:07:58 PM5/3/23
to Ansible Project
Thank you,  I am not using any credentials here as I restricted to run this Jenkins job on same Linux where ansible is installed.
now I  get this error,
/home/deploy-user/.jenkins/workspace/Ansible_Win_01 this is the location where my github is cloned
I specified this as inventory file location /home/deploy-user/.jenkins/workspace/Ansible_Win_01/ansible/inventory.txt
and playbook --/home/deploy-user/.jenkins/workspace/Ansible_Win_01/ansible/linux/linuxgitplaybook.yml
FATAL: command execution failed
java.io.IOException: Cannot run program "/usr/bin/ansible-playbook" (in directory "/home/deploy-user/.jenkins/workspace/Ansible_Win_01"): error=2, No such file or directory

Narmada Karthika

unread,
May 3, 2023, 8:52:18 PM5/3/23
to Ansible Project
I fixed my issue, its not sshpass  issue, the ansible executable path specified on global tool configuration is wrong. I found the executable path when I did anisble --version and I updated the same from the above output and the playbook is running fine.

Dick Visser

unread,
May 3, 2023, 11:16:15 PM5/3/23
to ansible...@googlegroups.com
Again this doesn't looks like an ansible problem but rather a generic problem with how to execute things in your specific environment.
Your statement that "you are restricted to run this.." means that you are doing this for someone, ask that person(s) to help you. 




Narmada Karthika

unread,
May 4, 2023, 1:27:37 AM5/4/23
to ansible...@googlegroups.com
True, it's not ansible problem. 
"I restricted to run" oh I am not running for anyone, this means on Jenkins I explicilty marked the slave where this ansible is running.


Reply all
Reply to author
Forward
0 new messages