Page MenuHome GnuPG

Can't uninstall gpg4win with Ansible
Open, NormalPublic


I am able to successfully install gpg4win with ansible for my users. However uninstalling is an issue. I have tried uninstalling with both the ansible uninstall module (win_package) and by running the uninstaller in an admin powershell silently. They both do not uninstall. I attached the two ansible snippets I have tried below. I have also tried many variations of these two but nothing has worked. The need for the uninstall is because for some users Right click -> Sign and encrypt no longer appears. When I uninstall and reinstall this functionality works again. All this is on Windows 10.

- name: Uninstall gpg4win from the registry
    product_id: 'Gpg4win'
    arguments: /S
    state: absent
- name: Uninstall gpg4win from the exe |
    & "C:\Program Files (x86)\Gpg4win\gpg4win-uninstall.exe" /S

Here is my working ansible install code for gpg4win.

install_dir: '{{ ansible_env.SystemDrive }}\Ansible'
install_url: ''
install_file: 'gpg4win-4.0.0.exe'
- name: 'Download gpg4win to Ansible Directory'
    url: '{{ install_url }}'
    dest: '{{ install_dir }}\{{ install_file }}'
  register: 'downloaded_file'

- name: 'Ensure gpg4win is installed'
    path: '{{ downloaded_file.dest }}'
    arguments: '/S'
    product_id: 'Gpg4win'