I’m hosting ansible host on Unbuntu and want to uninstall Teamviewer on windows client with openssh. I have tested that “C:\Program Files (x86)\TeamViewer\uninstall.exe” /S which im running locally from cmd works but Im struggling to run this from ansible in any way (win_command, win_shell, raw etc.) Task is passing but nothing happens. Currently after many tries I have this in c:\temp\command.bat and for example task
- name: Execute command.bat
win_command: c:\temp\command.bat
register: result
is giving me that but app is not uninstalled.
changed: [DESKTOP-TTV1HDR.local] => {
“changed”: true,
“cmd”: “c:\temp\command.bat”,
“delta”: “0:00:00.234340”,
“end”: “2023-10-20 12:41:41.207614”,
“invocation”: {
“module_args”: {
“_raw_params”: “c:\temp\command.bat”,
“argv”: null,
“chdir”: null,
“cmd”: null,
“creates”: null,
“output_encoding_override”: null,
“removes”: null,
“stdin”: null
}
},
“rc”: 0,
“start”: “2023-10-20 12:41:40.973274”,
“stderr”: “”,
“stderr_lines”: ,
“stdout”: “\r\nadmin@DESKTOP-TTV1HDR C:\Users\Admin>"C:\Program Files (x86)\TeamViewer\uninstall.exe" /S \r\n”,
“stdout_lines”: [
“”,
"admin@DESKTOP-TTV1HDR C:\Users\Admin>"C:\Program Files (x86)\TeamViewer\uninstall.exe" /S "
]
}
Below are tasks which I already tested:
- name: Uninstall TeamViewer
win_package:
path: “C:\Program Files (x86)\TeamViewer\uninstall.exe”
arguments: /S
state: absent - name: Run uninstall command
ansible.windows.win_command: ‘“C:\Program Files (x86)\TeamViewer\uninstall.exe” /S’
register: result - name: Choco Uninstall TV Host
win_chocolatey:
name: teamviewer.host
version: ‘15.46.7.0’
source: “http://10.0.50.17/nuget”
state: absent
Thanks for help