Hello All,
I am new in Ansible and was trying to execute a shell script in one of the remote hosts. The script runs fine when executed directly from the host. It is a simple shell script to create a folder.
The shell script is
Hello All,
I am new in Ansible and was trying to execute a shell script in one of the remote hosts. The script runs fine when executed directly from the host. It is a simple shell script to create a folder.
The shell script is
I can get the script run if I use the “command” module in the yml file
That shell script is not in your PATH. If you just created the
script, you should use "cmd: ./create_new_folder_pradipto.sh"
Hi Pradipto,
As you can see the error says “create_new_folder.sh: command not found”.
Just a little addition will resolve this issue.
The yml file is
Better use script module
Thank you all. Eventually I realized I should be using “script” instead of “shell”
Keep in mind
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/script_module.html#notes
Since your script just creates a directory that can be better done using an ansible file task.