通过詹金斯执行时找不到ansible-playbook

时间:2019-03-24 16:44:47

标签: jenkins ansible

我正在尝试通过jenkins运行一本ansible-playbook,但最后却显示一条错误消息

"ERROR! the playbook: /home/ansible/apache/provision.yml could not be found"

我尝试手动执行剧本,并且效果很好。我试图在权限透视图中进行调试。 Ansible剧本由用户“ ansible”和组“ ansible”拥有。 Jenkins由用户“ jenkins”运行,它也是“ ansible”组的一部分,但没有任何效果。以下是控制台输出中显示的内容。你们能建议我如何解决这个问题吗?

*
Building in workspace /var/lib/jenkins/workspace/Apache-Provision


[Apache-Provision] $ /usr/bin/ansible-playbook /home/ansible/apache/provision.yml -s -U ansible -f 5

ERROR! the playbook: /home/ansible/apache/provision.yml could not be found

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:81)
    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:1810)
    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 个答案:

答案 0 :(得分:0)

您可能已经从控制台重命名了Jenkins作业,并且每当您重命名它时,就会创建一个具有更新名称的新工作空间,请检查该工作空间并在jenkins配置中更新工作空间路径。