Kyle Morton
Kyle Morton

Reputation: 11

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!!

Upvotes: 1

Views: 1342

Answers (1)

mdaniel
mdaniel

Reputation: 33231

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

Upvotes: 1

Related Questions