That shell script is not in your PATH. If  you just created the
script, you should use "cmd: ./create_new_folder_pradipto.sh"

On Wed, Dec 8, 2021 at 10:03 PM pradipto dasgupta
<[email protected]> wrote:
>
>  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
> =============
> #!/bin/sh
> sudo mkdir new
> ==============
>
> The error I am getting is
> ======================
> fatal: [web1]: FAILED! => {"changed": true, "cmd": "create_new_folder.sh", 
> "delta": "0:00:00.021853", "end": "2021-12-09 02:34:21.464383", "msg": 
> "non-zero return code", "rc": 127, "start": "2021-12-09 02:34:21.442530", 
> "stderr": "/bin/sh: create_new_folder.sh: command not found", "stderr_lines": 
> ["/bin/sh: create_new_folder.sh: command not found"], "stdout": "", 
> "stdout_lines": []}
> =======================
>
>
> The yml file is
> =======================
> -
>  name: Play1
>  hosts: web1
>  tasks:
>   - name: Excute shell script
>     shell: create_new_folder_pradipto.sh
> ==============================
>
> I also tried changing the yml file to
>
> =======================
> -
>  name: Play1
>  hosts: web1
>  tasks:
>   - name: Excute shell script
>     shell:
>       cmd: create_new_folder_pradipto.sh
> ==============================
>
> Any idea what is wrong here
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/1027a91e-a3af-465b-afa0-48ba0684d3aan%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAOCN9ryvx88Tr%2Bq7u_zMd7xWn1SLJMv_j136E21cWJWE6793-w%40mail.gmail.com.

Reply via email to