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 ansible.windows.win_package: product_id: 'Gpg4win' arguments: /S state: absent
- name: Uninstall gpg4win from the exe ansible.windows.win_shell: | & "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: 'https://files.gpg4win.org/gpg4win-4.0.0.exe' install_file: 'gpg4win-4.0.0.exe'
- name: 'Download gpg4win to Ansible Directory' ansible.windows.win_get_url: url: '{{ install_url }}' dest: '{{ install_dir }}\{{ install_file }}' register: 'downloaded_file' - name: 'Ensure gpg4win is installed' ansible.windows.win_package: path: '{{ downloaded_file.dest }}' arguments: '/S' product_id: 'Gpg4win'