0

I have been trying to run Ansible playbook.yml file from Jenkins using Jenkins's Ansible plugin, but it is throwing file or directory is not found error. However, I crossed checked paths more than one time and they are correct. The playbook.yml also exists on the appropriate path. I also verified sshpass. Its latest version is installed on the linux master node.

Please note that. I have properly created the passwordless ssh connection between two Linux VMs machines. I am installing packages from Master Linux node to the slave Linux node using the playbook.yml file. My Jenkins is installed on window machine and I am using ansible plugin from there. I also added both Linux machines on Jekins node managements.

This is the error:

Started by user Admin
Running as SYSTEM
[EnvInject] - Loading node environment variables.
Building remotely on Linux_Master_Nodes (Linux_Master_Node) in workspace /data/jenkins/workspace/Invoke_Ansible_Playbook
[Invoke_Ansible_Playbook] $ sshpass ******** /data/ansible/ansible-playbook /data/ansible/playbooks/playbook.yml -f 5 -u root -k
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 hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:79)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
    at hudson.model.Build$BuildExecution.build(Build.java:206)
    at hudson.model.Build$BuildExecution.doRun(Build.java:163)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
    at hudson.model.Run.execute(Run.java:1816)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
ERROR: Ansible playbook execution failed
Finished: FAILURE

1 Answer 1

0

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

sshpass cannot run the command passed as argument.

Did you check that ansible is correctly installed on the jenkins slave in the path given on the command line ?

8
  • I installed it. I also cross checked it. It is there in the Linux_master_Nodes. I also created ssh passwordless connection between nodes..
    – saddique
    Commented Apr 17, 2019 at 16:05
  • Did you check your PATH variable for jenkins user on the slave to make sure sshpass is in there ? Commented Apr 17, 2019 at 16:11
  • OK. I just got all this wrong. The message means that sshpass itself could not excute the command given as argument. Commented Apr 17, 2019 at 16:15
  • Edited answer to reflect our conversation. Commented Apr 17, 2019 at 16:21
  • yes you are right. is it not ssh key sharing enough for the connection?
    – saddique
    Commented Apr 17, 2019 at 18:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .