简体   繁体   中英

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. I have the shabang in the beginnig of the script but im getting that message.

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. Please help!!

The current directory is never placed in the $PATH of a shell because it's a grave security risk. You'll want to specify the fully-qualified path to the script, which in your case, due to the chdir: is just ./ :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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