Application removal failed with 1603 error when msiexec command executed from ansible but same command worked locally on windows

I am writing an ansible playbook to uninstall an application and then install its updated version. First, I tried to get the guid and then uninstall it. Here is the section from the playbook:

- name: Get the GUID of application   raw: Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -match "app1" } | select -ExpandProperty IdentifyingNumber   register: app1   - name: Uninstall existing version   raw: start-process msiexec.exe -arg "/X {{ app1.stdout }} /qn /lv app1.MSIuninstall.log" 

This did not work and I am still trying to figure out why. I think because \r\n is coming at the end of the GUID value and may be messing it up, and right now I don't know how to rectify that. Will try to club it all in one command instead of storing the GUID in a variable. Also, the log file did not contain any data. This is the ansible command output for getting the GUID and then the uninstall command:

ok: [servername] => {"changed": false, "invocation": {"module_args": {"_raw_params": "Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -match \"app1\" } | select -ExpandProperty IdentifyingNumber"}, "module_name": "raw"}, "rc": 0, "stderr": "", "stdout": "{CA483236-0405-11E3-B677-3AC26088709B}\r\n", "stdout_lines": ["{CA483236-0405-11E3-B677-3AC26088709B}"]}

ok: [servername] => {"changed": false, "invocation": {"module_args": {"_raw_params": "start-process msiexec.exe -arg \"/X {CA483236-0405-11E3-B677-3AC26088709B}\r\n /qn /lv app1.MSIuninstall.log\""}, "module_name": "raw"}, "rc": 0, "stderr": "", "stdout": "", "stdout_lines": []}

Then I tried uninstalling it by directly passing the GUID as a step to check if something is going wrong when I am storing the GUID in the ansible variable. This is the task to uninstall:

- name: Uninstall existing version   raw: start-process msiexec.exe -arg "/X {CA483236-0405-11E3-B677-3AC26088709B} /qn /lv app1.MSIuninstall.log" 

The output I got is this and the uninstall failed with 1603 error in the log file:

ok: [c418jny.tlr.thomson.com] => {"changed": false, "invocation": {"module_args": {"_raw_params": "start-process msiexec.exe -arg \"/X {CA483236-0405-11E3-B979-3AC26088709B} /qn /lv TR.OA.UI.MSIuninstall.log\""}, "module_name": "raw"}, "rc": 0, "stderr": "", "stdout": "", "stdout_lines": []}

I read through the uninstall log file and was not able to find out any specific error. Will try to give it a deeper look.

Then I ran the uninstall command on the server and it succeeded:

msiexec /x {CA483236-0405-11E3-B677-3AC26088709B} 

I may be able to replicate this error by trying on another server or installing the same version and then try to uninstall it. But before that, if someone can guide as to what extra I should do so I can get more information about why the remote uninstall could have failed, it will be very helpful. Or, if someone has faced this kind of problem and may have the solution, please share.

Ansible version 2.1.0.0

Windows 2008 R2

PSVersion 5.0.10586.117

Thanks.

Replay

Category: ansible Time: 2016-07-29 Views: 0
Tags: msi ansible

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.259 (s). 12 q(s)