# how to debug random errors on win\_msi Windows module?

**URL:** <https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [August 26, 2014, 9:32pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046 "2014-08-26T21:32:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Damon\_Overboe](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@Damon\_Overboe](https://forum.ansible.com/u/Damon_Overboe)\
**Post date:** [August 26, 2014, 9:32pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/1 "2014-08-26T21:32:31Z")

</div>

I know about calling with the -vvvv option, and that displays what the error is, but I’m wondering what I need to do to get to the root of the problem.

I’ve had great success with the win\_get\_url. I’ve had some success with the win\_msi module, but some failures as well, and they’re usually pretty serious.

I’m on the latest of the development branch, \* 75bd1fa Tue Aug 26 11:49:02 2014 -0500

I’ve also recently put Trond’s changes / improvements into the win\_msi module and see the same results.

So what I’d like to know is, other than the info that’s spit out when passing -vvvv, what should I be looking for on the host to help debug this? Nothing in /var/log jumped out at me.

---

<div class="post-metadata">

**Author:** ![Damon\_Overboe](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@Damon\_Overboe](https://forum.ansible.com/u/Damon_Overboe)\
**Post date:** [August 26, 2014, 9:34pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/2 "2014-08-26T21:34:06Z")

</div>

Here is the recipe

`

---

<div class="post-metadata">

**Author:** ![Damon\_Overboe](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@Damon\_Overboe](https://forum.ansible.com/u/Damon_Overboe)\
**Post date:** [August 26, 2014, 9:37pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/3 "2014-08-26T21:37:57Z")

</div>

Here is a subsequent success on both (ran again bc the HTTP 500 isn’t  
the error I normally see)

ok: [[node1.domain.com](http://node1.domain.com)] =\> {“changed”: false, “exit\_reason”: {“name”: “File specified in creates parameter already exists”}}  
\<[node3.domain.com](http://node3.domain.com)\> WINRM RESULT \<Response code 0, out “{ “changed”: t”, err " Process is terminat"\>  
changed: [[node3.domain.com](http://node3.domain.com)] =\> {“changed”: true, “log”: “C:\Users\dummy\AppData\Local\Temp\tmp30A4.tmp”}

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [August 26, 2014, 9:50pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/4 "2014-08-26T21:50:29Z")

</div>

Hi Damon,

That’s weird,  
I tried your playbook on two 2012R2 hosts just now, and it worked fine. Only thing I noticed is that you’re saving to a “non-standard” folder. Could you test it by setting the dest to dest: ‘C:\tortoise-1.7.msi’ or something in win\_Get\_url?

About debugging: It’s kinda hard, because Ansible cleans up the temp files. I’m gonna post an issue to see if we can get a “win\_debug” setting in ansible.cfg to enable leaving the files in place so that we can run the generated script and param file through a normal PowerShell debugger. For now you have to take the params you send and store them as a json file. Then, combine the module ps1 file with the powershell.ps1 file into a single file and execute that file in powershell with the params file as the first and only argument. Its bothersome to say the least.

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [August 26, 2014, 9:55pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/5 "2014-08-26T21:55:53Z")

</div>

BTW, i have a brand spankin new win\_package module coming up which will handle not only msis but all kinds of installs, and also supports auto-downloading source files from a url so that you don’t need to win\_get\_url first. I’m waiting for some improvements to the powershell helper scripts to be merged before i PR that module, but let me know and I’d be happy to share it with you.

-Trond

---

<div class="post-metadata">

**Author:** ![Damon\_Overboe](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@Damon\_Overboe](https://forum.ansible.com/u/Damon_Overboe)\
**Post date:** [August 26, 2014, 9:56pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/6 "2014-08-26T21:56:16Z")

</div>

That would be awesome on the debugging, because I’d like to be able to help, but feel kinda helpless.

Yeah since switching to your changes (which I guess I forgot to link to) it’s been working better generally, because it’s seeing that the product is installed so it doesn’t try to run it again.

I’m going to try removing the bit that checks if it’s already installed and run it a few more times.

What I saw earlier was before your changes, it would usually install successfully the first time and sometimes even the second time, but eventually it’d start throwing the SOs.

---

<div class="post-metadata">

**Author:** ![Damon\_Overboe](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@Damon\_Overboe](https://forum.ansible.com/u/Damon_Overboe)\
**Post date:** [August 26, 2014, 10:00pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/7 "2014-08-26T22:00:08Z")

</div>

Yah that’d be great. I’ll happily test it out if you like.

I’m only targeting Svr 12s, and just using it right now to set up new build agent nodes. I want to do a lot more with it but figured that would be a good place to start.

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [August 26, 2014, 10:07pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/8 "2014-08-26T22:07:09Z")

</div>

Cool, I’m writing up a short doc and putting it on a branch in my ansible fork right now. Will send you links and stuffs in a couple of minutes.

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [August 26, 2014, 10:15pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/9 "2014-08-26T22:15:45Z")

</div>

Here you go sir:  
[https://github.com/trondhindenes/ansible/tree/win\_package](https://github.com/trondhindenes/ansible/tree/win_package)

Note that I’m using the updated helper functions from the main powershell.ps1 script, so you’ll need to grab that as well. You can grab if from this PR:  
[https://github.com/ansible/ansible/pull/8759](https://github.com/ansible/ansible/pull/8759) (the powershell.ps1 file goes in /lib/ansible/module\_utils in your ansible directory structure)

---

<div class="post-metadata">

**Author:** ![Damon\_Overboe](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@Damon\_Overboe](https://forum.ansible.com/u/Damon_Overboe)\
**Post date:** [August 26, 2014, 10:20pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/10 "2014-08-26T22:20:37Z")

</div>

I’m still somewhat of a git noob;

I’ve cloned your repo, but I’m not sure how to get the pull request from 8759 into that clone…

I’m guessing there’s a command to merge, any pointers?

---

<div class="post-metadata">

**Author:** ![Damon\_Overboe](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@Damon\_Overboe](https://forum.ansible.com/u/Damon_Overboe)\
**Post date:** [August 26, 2014, 10:25pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/11 "2014-08-26T22:25:20Z")

</div>

I found this…

[http://stackoverflow.com/a/1426163/734790](http://stackoverflow.com/a/1426163/734790)

I’m testing that out.

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [August 26, 2014, 10:25pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/12 "2014-08-26T22:25:46Z")

</div>

Me too. I would just grab the file manually and stick it in your on fork for now:  
[https://raw.githubusercontent.com/trondhindenes/ansible/win\_setup\_json\_depth/lib/ansible/module\_utils/powershell.ps1](https://raw.githubusercontent.com/trondhindenes/ansible/win_setup_json_depth/lib/ansible/module_utils/powershell.ps1)

My repo has a branch for each change/PR i’ve submitted, so you’re probably better off forking the original ansible code and just come up with your own way of managing the various changes you put in it. I guess I should try and rebase everything back into my devel branch, but it’s that’s not the case right now.

---

<div class="post-metadata">

**Author:** ![Damon\_Overboe](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@Damon\_Overboe](https://forum.ansible.com/u/Damon_Overboe)\
**Post date:** [August 26, 2014, 10:36pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/13 "2014-08-26T22:36:19Z")

</div>

That’s exactly what I did to get your changes into the mainline, so I’m doing that again.

You want me to post feedback (if I have any) in this thread or on the pull request?

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [August 26, 2014, 10:40pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/14 "2014-08-26T22:40:07Z")

</div>

This thread is fine. I haven’t submitted a PR for win\_package just yet.

---

<div class="post-metadata">

**Author:** ![Damon\_Overboe](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@Damon\_Overboe](https://forum.ansible.com/u/Damon_Overboe)\
**Post date:** [August 26, 2014, 10:48pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/15 "2014-08-26T22:48:35Z")

</div>

There it is, finally!!!

This is still using the win\_msi, I’ll switch to the win\_package now.

I’m not sure why but I just wasn’t going to be happy until I broke it.

`  
changed: [[node1.domain.com](http://node1.domain.com)]  
Traceback (most recent call last):  
File “/home/damon/src/ansible/lib/ansible/runner/connection\_plugins/winrm.py”, line 149, in exec\_command  
result = self.\_winrm\_exec(cmd\_parts[0], cmd\_parts[1:], from\_exec=True)  
File “/home/damon/src/ansible/lib/ansible/runner/connection\_plugins/winrm.py”, line 118, in \_winrm\_exec  
response = Response(self.protocol.get\_command\_output(self.shell\_id, command\_id))  
File “/usr/local/lib/python2.7/dist-packages/winrm/protocol.py”, line 277, in get\_command\_output  
self.\_raw\_get\_command\_output(shell\_id, command\_id)  
File “/usr/local/lib/python2.7/dist-packages/winrm/protocol.py”, line 293, in \_raw\_get\_command\_output  
rs = self.send\_message(xmltodict.unparse(rq))  
File “/usr/local/lib/python2.7/dist-packages/winrm/protocol.py”, line 173, in send\_message  
return self.transport.send\_message(message)  
File “/usr/local/lib/python2.7/dist-packages/winrm/transport.py”, line 90, in send\_message  
raise WinRMTransportError(error\_message)  
WinRMTransportError: Bad HTTP response returned from server. Code 500  
fatal: [[node3.domain.com](http://node3.domain.com)] =\> failed to exec cmd PowerShell -NoProfile -NonInteractive -EncodedCommand KABOAGUAdwAtAEkAdABlAG0AIAAtAFQAeQBwAGUAIABEAGkAcgBlAGMAdABvAHIAeQAgAC0AUABhAHQAaAAgACQAZQBuAHYAOgB0AGUAbQBwACAALQBOAGEAbQBlACAAIgBhAG4AcwBpAGIAbABlAC0AdABtAHAALQAxADQAMAA5ADAAOQAyADkAOAA2AC4ANgAtADIANwA2ADMAMAA3ADAAMAA2ADUAMgA0ADEAOAAiACkALgBGAHUAbABsAE4AYQBtAGUAIAB8ACAAVwByAGkAdABlAC0ASABvAHMAdAAgAC0AUwBlAHAAYQByAGEAdABvAHIAIAAnACcAOwA=

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [August 26, 2014, 10:53pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/16 "2014-08-26T22:53:23Z")

</div>

Nice,  
So, Chris just tipped me about this ansible.cfg setting:  
[defaults]  
keep\_remote\_files = 1

Stick that in your /ansible/etc/ansible.cfg and re-run your playbook with -vvv

All those temp paths Ansible uses for powershell files will now be left on your windows system. Each folder basically has a script file (the module) and an arguments file. That should do wonders for debugging windows modules (it would still require some PowerShell proficiency tho)

---

<div class="post-metadata">

**Author:** ![Damon\_Overboe](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@Damon\_Overboe](https://forum.ansible.com/u/Damon_Overboe)\
**Post date:** [August 26, 2014, 11:25pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/17 "2014-08-26T23:25:56Z")

</div>

Awesome I’ll give that as shot.

The biggest thing I wanted to know was how to catch the output so I can at least try to debug it or ask for help, so that’ll be huge.

I’m off for the night tonight but I’ll be testing out win\_package tomorrow for sure. I’ll let you know how it goes.

---

<div class="post-metadata">

**Author:** ![Damon\_Overboe](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@Damon\_Overboe](https://forum.ansible.com/u/Damon_Overboe)\
**Post date:** [August 28, 2014, 3:44pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/18 "2014-08-28T15:44:51Z")

</div>

OK I’m testing it out.

First, I love that you can pass arguments. I have been automating the Jenkins clients; I’m adding a specific version of SVN, and with the win\_msi installer, I couldn’t figure out how to pass arguments to it so it would install the Command Line Interface.

With the win\_package, that is super easy, so I was happy to see that!

But I ran into my first situation; if you give it a URL and the download file doesn’t include the extension, it will fail to install. Test out this url:

[http://sourceforge.net/projects/tortoisesvn/files/1.7.15/Application/TortoiseSVN-1.7.15.25753-x64-svn-1.7.18.msi/download](http://sourceforge.net/projects/tortoisesvn/files/1.7.15/Application/TortoiseSVN-1.7.15.25753-x64-svn-1.7.18.msi/download)

Running a plain wget, `wget http://sourceforge.net/projects/tortoisesvn/files/1.7.15/Application/TortoiseSVN-1.7.15.25753-x64-svn-1.7.18.msi/download` will download the installer as “download” so I’m assuming the scripts are doing the same.

So, it probably needs an option to specify the output file, much like you would with `wget -o` or `wget --output-file`.

---

<div class="post-metadata">

**Author:** ![Damon\_Overboe](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@Damon\_Overboe](https://forum.ansible.com/u/Damon_Overboe)\
**Post date:** [August 28, 2014, 3:59pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/19 "2014-08-28T15:59:29Z")

</div>

I changed it to run win\_get\_url to download the package so I could rename the file (using ‘dest’).

And then, I hit a nice System.OutOfMemoryException. This server isn’t that beefy and it’s wanting to run updates, so it could be that… but I’m going to try to grab the remote files anyway.

I wasn’t running -vvvv, here’s what I saw:

failed: [clone] =\> {“failed”: true, “parsed”: false}  
invalid output was: Exception of type ‘System.OutOfMemoryException’ was thrown.  
At C:\Users\dummy\AppData\Local\Temp\ansible-tmp-1409241114.17-71859971213315  
\win\_package.ps1:1395 char:5

- if ($testdscresult -eq $true)
- 

```auto

```

- CategoryInfo : OperationStopped: (🙂 , OutOfMemoryException
- FullyQualifiedErrorId : System.OutOfMemoryException

FATAL: all hosts have already failed – aborting

---

<div class="post-metadata">

**Author:** ![Damon\_Overboe](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@Damon\_Overboe](https://forum.ansible.com/u/Damon_Overboe)\
**Post date:** [August 28, 2014, 5:26pm UTC](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046/20 "2014-08-28T17:26:44Z")

</div>

Cool I just hit the StackOverflow again.

I used win\_get\_url to download, and then win\_package to install. I am using the updated powershell.ps1 script from 8759, but I have seen it without that as well.

`  
failed: [clone] =\> {“failed”: true, “parsed”: false}  
invalid output was:  
Process is terminated due to StackOverflowException.

FATAL: all hosts have already failed – aborting

[Next page](https://forum.ansible.com/t/how-to-debug-random-errors-on-win-msi-windows-module/16046.md?page=2)
