uninstall windows packages via ansible

46 views
Skip to first unread message

andregr...@gmail.com

unread,
Dec 12, 2023, 9:57:04 AM12/12/23
to Ansible Project
hi,
i am trying to update some windows software packages, e.g. notepad++ and firefox. it doesn't work, because the installed software can't be removed or updated.

having a look onto notepad++ version 8.1.x is installed, 8.6 should get installed. i am using an executable:

    - name: install NotepadPlusPlus {{ nppversion }}
      win_package:
        path: "C:\\temp\\npp.{{ nppversion }}.Installer.x64.exe"
        product_id: Notepad++
        arguments: /S
        state: present
      when: inventory_hostname in groups["notepadplusplus"]

ansible quits with "ok", but the version is still 8.1.x

trying to remove the package with powershell fails:
uninstall via win_shell with 'get-package -name "notepad*" -maxversion 8.5 | uninstall-package -Force' tells "changed", but software is still existing on the server.



any idea how to solve this?

TASK [remove notepad++ win_shell] ****************************************************************************************************************************************************************************
changed: [myserver]

TASK [debug packagestatus] ***********************************************************************************************************************************************************************************
ok: [myserver] => {
    "packagestatus": {
        "changed": true,
        "cmd": "get-package \"Notepad*\" -maximumversion 8.5 | uninstall-package -Force -scope allusers",
        "delta": "0:01:08.874457",
        "end": "2023-12-12 02:55:48.249888",
        "failed": false,
        "rc": 0,
        "start": "2023-12-12 02:54:39.375431",
        "stderr": "",
        "stderr_lines": [],
        "stdout": "",
        "stdout_lines": []
    }
}

regards,
andre
Reply all
Reply to author
Forward
0 new messages