简体   繁体   English

无法使用 Ansible Tower 在远程节点上访问和执行脚本

[英]Cant access and execute a script on remote node using Ansible Tower

I have a similar problem but my error message says:我有类似的问题,但我的错误消息说:

{
"changed": false,
"msg": "Could not find or access 'woshutdown.sh'
Searched in: /var/ansible/tmp/awx_29146_42q4g5dt/project/qadeployment/files/woshutdown.sh
/var/ansible/tmp/awx_29146_42q4g5dt/project/qadeployment/woshutdown.sh
/var/ansible/tmp/awx_29146_42q4g5dt/project/qadeployment/files/woshutdown.sh
/var/ansible/tmp/awx_29146_42q4g5dt/project/qadeployment/woshutdown.sh on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option"
}

My script is call woshutdown.sh and it is meant call on another script that shuts down the remote server that it is located on.我的脚本是调用 woshutdown.sh,它意味着调用另一个脚本来关闭它所在的远程服务器。 I have the shabang in the beginnig of the script but im getting that message.我在脚本的开头有 shabang,但我得到了那个信息。

This is my playbook: Playbook for the above task这是我的剧本:上述任务的剧本

This is where the script is located: Location of Script on remote server这是脚本所在的位置:远程服务器上的脚本位置

I have tried Script Module I have tried CMD module and sh command.我试过脚本模块我试过 CMD 模块和 sh 命令。 Please help!!请帮忙!!

The current directory is never placed in the $PATH of a shell because it's a grave security risk.当前目录永远不会放在 shell 的$PATH中,因为它存在严重的安全风险。 You'll want to specify the fully-qualified path to the script, which in your case, due to the chdir: is just ./ :您需要指定脚本的完全限定路径,在您的情况下,由于chdir:只是./

- name: shutdown etc etc
  command: ./woshutdown.sh
  args:
    chdir: /methode/common/etc-etc-etc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM