已使用 NSIS 安装程序在目标计算机上安装了一个 Windows 应用程序C:\Program Files\my_app\
。在该文件夹中还有卸载程序Uninstall.exe
。我正在尝试编写一个可以静默运行该卸载程序的 ansible 任务。与该目标机器的连接是使用完成的
ansible_connection: winrm
使用 cmd 提示在目标机器上手动运行以下命令可成功且静默地删除应用程序:
"C:\Program Files\my_app\Uninstall.exe" /S
但是,当尝试实现我的 ansible 任务时,我无法让它工作。我试过以下
win_shell: '"C:\Program Files\my_app\Uninstall.exe" /S'
args:
executable: cmd
和
win_command: '"C:\Program Files\my_app\Uninstall.exe" /S'
这两项任务均已完成且未出现错误,但未卸载应用程序。这是运行这些任务时的相关输出:
{
"start": "2021-11-13 08:37:57.146265",
"stdout": "",
"cmd": "\"C:\\Program Files\\my_app\\Uninstall.exe\" /S",
"stderr": "",
"changed": true,
"rc": 0,
"delta": "0:00:00.533985",
"end": "2021-11-13 08:37:57.680251",
"stdout_lines": [],
"stderr_lines": [],
"_ansible_no_log": false
}
我在这里想念什么?非常感谢
编辑
安装程序不会在 Windows 注册表中创建条目,因此使用 ansible 'win_package' 不适用,因为我没有可以使用的 'product_id'。