使用Rundeck从文件运行Ansible playbook。

huangapple go评论75阅读模式
英文:

Running Ansible playbook from a file in Rundeck

问题

我正试图运行存储在我的本地驱动器中的Ansible playbook。我正在使用已安装了Ansible和Rundeck的wsl 2。

Playbook路径:/home/hannan/wslNodeRedProjects/ansible/myplaybook1.yml

在提供正确的playbook位置后,我收到以下错误:

错误!找不到playbook:/home/hannan/wslNodeRedProjects/ansible/myplaybook1.yml

失败:AnsibleNonZero:错误:Ansible执行返回非零代码。

我不确定为什么即使在指定正确位置后仍然出现错误。

我想知道是否我漏掉了什么,或者我是否需要提供其他选项,比如Ansible二进制文件目录路径。

英文:

I am trying to run Ansible playbook stored in my local drive. I am using wsl 2 which is where I have installed Ansible and Rundeck.

使用Rundeck从文件运行Ansible playbook。

Playbook path: /home/hannan/wslNodeRedProjects/ansible/myplaybook1.yml

On providing the correct location of the playbook I get the following errors:

ERROR! the playbook: /home/hannan/wslNodeRedProjects/ansible/myplaybook1.yml could not be found

*Failed: AnsibleNonZero: ERROR: Ansible execution returned with non zero code.
*

使用Rundeck从文件运行Ansible playbook。

I am not sure why I am getting an error even after specifying the correct location.

I wanted to know if I am missing anything or should I need to provide other options like Ansible binaries directory path as well.

答案1

得分: 2

这个错误可能表明,建立本地SSH连接以执行playbook的用户(默认为rundeck)没有对完整playbook路径的可执行权限。

可以通过以下两种方式解决这个问题,一是使用具有正确可执行权限的用户,二是通过ACL授予特定用户可执行权限,如下所示:

$ setfacl -R -m user:rundeck:x /path/to/playbook/
  • setfacl - 设置文件访问控制列表。
  • -R, --recursive - 递归地对所有文件和目录应用操作。
  • -m, --modify - 修改文件或目录的ACL。此操作的ACL条目必须包括权限。

有关更多信息,请参阅man setfacl

英文:

This error might indicate that the user establishing the local SSH connection to execute the playbook (default: rundeck) doesn't have executable permissions to the full playbook path.

This could be resolved by either using a user with the right executable permissions, or by granting executable permissions to the specific user with ACL, like so:

$ setfacl -R -m user:rundeck:x /path/to/playbook/
  • setfacl - set file access control lists.
  • -R, --recursive -
    apply operations to all files and directories recursively.
  • -m, --modify -
    modify the ACL of a file or directory. ACL entries for this operation must include permissions.

See man setfacl for further reading.

huangapple
  • 本文由 发表于 2023年1月9日 11:09:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/75052852.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定