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.

Reply via email to