# Issue ----  Module Failure\\nSee stdout/stderr

**URL:** <https://forum.ansible.com/t/issue-module-failure-nsee-stdout-stderr/35875>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [October 14, 2021, 11:01pm UTC](https://forum.ansible.com/t/issue-module-failure-nsee-stdout-stderr/35875 "2021-10-14T23:01:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhijot\_Singh\_Kathur](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@Abhijot\_Singh\_Kathur](https://forum.ansible.com/u/Abhijot_Singh_Kathur)\
**Post date:** [October 14, 2021, 11:01pm UTC](https://forum.ansible.com/t/issue-module-failure-nsee-stdout-stderr/35875/1 "2021-10-14T23:01:30Z")

</div>

Hey Guys,

I need some assistance on the below error. I’ve tried everything but I’m not able to resolve the same.

TASK [Join to Domain] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /etc/ansible/playbooks/DeployVM/Server2019\_Vsphere.yml:46  
 ESTABLISH LOCAL CONNECTION FOR USER: administrator  
 EXEC /bin/sh -c ‘echo ~administrator && sleep 0’  
 EXEC /bin/sh -c ‘( umask 77 && mkdir -p “`echo /home/administrator/.ansible/tmp`”&& mkdir “`echo /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149`” && echo ansible-tmp-1634251564.5118623-32501-66747911642149=“`echo /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149`” ) && sleep 0’  
Using module file /home/administrator/.ansible/collections/ansible\_collections/ansible/windows/plugins/modules/win\_domain\_membership.ps1  
 PUT /home/administrator/.ansible/tmp/ansible-local-324573ec1oxrx/tmp\_rkwbrs9 TO /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ\_win\_domain\_membership.ps1  
 EXEC /bin/sh -c ‘chmod u+x /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/ /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ\_win\_domain\_membership.ps1 && sleep 0’  
 EXEC /bin/sh -c ‘powershell /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ\_win\_domain\_membership.ps1 && sleep 0’  
 EXEC /bin/sh -c ‘rm -f -r /home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/ \> /dev/null 2\>&1 && sleep 0’  
fatal: [localhost]: FAILED! =\> {  
“changed”: false,  
“module\_stderr”: “\u001b[91mParserError: \u001b[0m/home/administrator/.ansible/tmp/ansible-tmp-1634251564.5118623-32501-66747911642149/AnsiballZ\_win\_domain\_membership.ps1:151\n\u001b[96mLine |\n\u001b[96m 151 | \u001b[0m \u001b[96m\u0000\u001b[0m\u0000\u0000\u0000{"module\_entry": "IyFwb3dlcnNoZWxsCgojIENvcHlyaWdodDogKGMpIDIwMTc …\n\u001b[96m | \u001b[91m ~\n\u001b[91m\u001b[96m | \u001b[91munexpected token ‘\u0000’, expected ‘begin’, ‘process’, ‘end’, or\n\u001b[96m | \u001b[91m’dynamicparam’.\n\u001b[0m\n”,  
“module\_stdout”: “”,  
“msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”,  
“rc”: 1  
}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
localhost : ok=1 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

So technically I’m trying to spin a VM in vSphere and connect that Vm to domain using Ansible and below is what my playbook looks like:

---

<div class="post-metadata">

**Author:** ![Jorge\_Rua1](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@Jorge\_Rua1](https://forum.ansible.com/u/Jorge_Rua1)\
**Post date:** [October 14, 2021, 11:11pm UTC](https://forum.ansible.com/t/issue-module-failure-nsee-stdout-stderr/35875/2 "2021-10-14T23:11:15Z")

</div>

Obviously, you would need to run the join domain task against the newly created VM. To do that you should use delegate\_to.

I would change your inventory to all, and then on the vmware related tasks use delegate\_to: localhost since what is happening behind the scenes are just soap/rest api calls against vcenter.

You should also pay attention to the conection plugin.

Hope that helps

---

<div class="post-metadata">

**Author:** ![Abhijot\_Singh\_Kathur](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@Abhijot\_Singh\_Kathur](https://forum.ansible.com/u/Abhijot_Singh_Kathur)\
**Post date:** [October 14, 2021, 11:22pm UTC](https://forum.ansible.com/t/issue-module-failure-nsee-stdout-stderr/35875/3 "2021-10-14T23:22:20Z")

</div>

Hey Jorge,

Thanks for your reply.

I tried making the inventory to all and adding delegate\_to: localhost. No luck here.

Still getting the same error message.

---

<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:** [October 15, 2021, 4:28am UTC](https://forum.ansible.com/t/issue-module-failure-nsee-stdout-stderr/35875/4 "2021-10-15T04:28:44Z")

</div>

The advice given should work.  
Please share your exact playbook once again.

---

<div class="post-metadata">

**Author:** ![Abhijot\_Singh\_Kathur](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@Abhijot\_Singh\_Kathur](https://forum.ansible.com/u/Abhijot_Singh_Kathur)\
**Post date:** [October 15, 2021, 4:32am UTC](https://forum.ansible.com/t/issue-module-failure-nsee-stdout-stderr/35875/5 "2021-10-15T04:32:53Z")

</div>

Hey Dick,

Here is the playbook:

 ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/f/fb2895cb9ca294cbb027bfddb666efd044d6b1a1.png)

---

<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:** [October 15, 2021, 8:43am UTC](https://forum.ansible.com/t/issue-module-failure-nsee-stdout-stderr/35875/6 "2021-10-15T08:43:48Z")

</div>

The VMware task should run local and the domain task should run against the host.

> **(attachments)**
>
> ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/f/fb2895cb9ca294cbb027bfddb666efd044d6b1a1.png)

---

<div class="post-metadata">

**Author:** ![Abhijot\_Singh\_Kathur](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@Abhijot\_Singh\_Kathur](https://forum.ansible.com/u/Abhijot_Singh_Kathur)\
**Post date:** [October 15, 2021, 7:30pm UTC](https://forum.ansible.com/t/issue-module-failure-nsee-stdout-stderr/35875/7 "2021-10-15T19:30:25Z")

</div>

Hey Dick,

Changed the localhost for the domain task to the host itself. No help, still getting the same error:

fatal: [localhost → ans-dv4-test1]: FAILED! =\> {  
“changed”: false,  
“module\_stderr”: “\u001b[91mParserError: \u001b[0m/home/administrator/.ansible/tmp/ansible-tmp-1634325122.8927026-35811-261246352817343/AnsiballZ\_win\_domain\_membership.ps1:151\n\u001b[96mLine |\n\u001b[96m 151 | \u001b[0m \u001b[96m\u0000\u001b[0m\u0000\u0000\u0000{"module\_entry": "IyFwb3dlcnNoZWxsCgojIENvcHlyaWdodDogKGMpIDIwMTc …\n\u001b[96m | \u001b[91m ~\n\u001b[91m\u001b[96m | \u001b[91munexpected token ‘\u0000’, expected ‘begin’, ‘process’, ‘end’, or\n\u001b[96m | \u001b[91m’dynamicparam’.\n\u001b[0m\n”,  
“module\_stdout”: “”,  
“msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”,  
“rc”: 1  
}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
localhost : ok=1 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

Here is the playbook again:

---

<div class="post-metadata">

**Author:** ![Jorge\_Rua1](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@Jorge\_Rua1](https://forum.ansible.com/u/Jorge_Rua1)\
**Post date:** [October 15, 2021, 8:27pm UTC](https://forum.ansible.com/t/issue-module-failure-nsee-stdout-stderr/35875/8 "2021-10-15T20:27:22Z")

</div>

I guess the issue now is that you are trying to use connection plugin local to the newly created vm, which I assume is a windows machine. Then you should override connection mechanism for those tasks dealing with windows or as you suggested spliting the playbook into two, one dealing with vcenter api and the other for vm setup.

If you never setup ansible with windows before i suggest you using ssh, it’s natively supported on newer versions and it doesnt require setting up winrm.

Cheers,
