# Shell Module Code Not Executing

**URL:** <https://forum.ansible.com/t/shell-module-code-not-executing/36149>\
**Category:** Ansible Project\
**Created:** [December 23, 2021, 8:27am UTC](https://forum.ansible.com/t/shell-module-code-not-executing/36149 "2021-12-23T08:27:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jitender\_J](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@Jitender\_J](https://forum.ansible.com/u/Jitender_J)\
**Post date:** [December 23, 2021, 8:27am UTC](https://forum.ansible.com/t/shell-module-code-not-executing/36149/1 "2021-12-23T08:27:18Z")

</div>

Hi Team,

Need you help on below issue

I am facing issue where code inside shell module is not getting executed over some remote server, ansible just passing the got without executing without any error,

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [December 23, 2021, 8:30am UTC](https://forum.ansible.com/t/shell-module-code-not-executing/36149/2 "2021-12-23T08:30:11Z")

</div>

That’s almost zero information.  
Provide a full playbook and any other relevant information.

---

<div class="post-metadata">

**Author:** ![Jitender\_J](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@Jitender\_J](https://forum.ansible.com/u/Jitender_J)\
**Post date:** [December 23, 2021, 8:44am UTC](https://forum.ansible.com/t/shell-module-code-not-executing/36149/3 "2021-12-23T08:44:36Z")

</div>

Hi

Below is the piece of code I am trying to execute, it is running fine over 500 nodes but there are some hosts in different environments where ansible not executing the code inside the shell module  
just passing the code without any error/output

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [December 23, 2021, 8:49am UTC](https://forum.ansible.com/t/shell-module-code-not-executing/36149/4 "2021-12-23T08:49:35Z")

</div>

> Hi
> 
> Below is the piece of code I am trying to execute, it is running fine over 500 nodes but there are some hosts in different environments where ansible not executing the code inside the shell module

Problems with arbitrary shell scripts is not related to Ansible IMHO.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Roberto\_J\_R\_Paz](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@Roberto\_J\_R\_Paz](https://forum.ansible.com/u/Roberto_J_R_Paz)\
**Post date:** [December 24, 2021, 12:48pm UTC](https://forum.ansible.com/t/shell-module-code-not-executing/36149/5 "2021-12-24T12:48:32Z")

</div>

My two cents: if you have pretty much the whole action you want as part of a already existent shell script who runs smoothly, maybe the best approach is to:

1. Copy script to remote managed server
2. Run script remotely using “shell” module.

Off course this is a lame use of ansible, but trying to embeed a full script into a single call for the shell module will be probably a bigger pain.

Eventually in time you can try to replace some of the shell steps with native ansible call to make a good use of it.
