Fix 1password role on Windows

When 1password is already installed and the installer is invoked, it
hangs because it launches the GUI and never returns.
This commit is contained in:
Kenneth Benzie 2023-07-29 11:33:49 +01:00
parent e625f463d7
commit 3b312e6f9a

View File

@ -11,36 +11,21 @@
path: '{{app_exe}}' path: '{{app_exe}}'
register: app_stat register: app_stat
- name: get installed version
when: app_stat.stat.exists == True
win_command: '{{app_exe}} --version'
register: app_version
changed_when: false
- when: app_stat.stat.exists == True
set_fact:
installed_version: '{{app_version.stdout.strip()}}'
- name: download latest installer - name: download latest installer
when: not app_stat.stat.exists
win_get_url: win_get_url:
url: https://downloads.1password.com/win/1PasswordSetup-latest.exe url: https://downloads.1password.com/win/1PasswordSetup-latest.exe
dest: '{{installer_exe}}' dest: '{{installer_exe}}'
- name: get installer version
win_shell: |
(Get-ItemProperty {{installer_exe}}).VersionInfo.ProductVersion
register: installer_product_version
changed_when: false
# FIXME: The [5:] is to account for a mystery "\e[6 q" prefix, not sure if this
# is consistent across machines or some other oddity.
- set_fact:
installer_version: '{{installer_product_version.stdout.strip()[5:]}}'
- name: run installer - name: run installer
when: installed_version is not defined or installed_version != installer_version when: not app_stat.stat.exists
win_command: '{{installer_exe}}' win_command: '{{installer_exe}}'
- name: remove installer
win_file:
path: '{{installer_exe}}'
state: absent
- name: create start menu shortcut - name: create start menu shortcut
win_shortcut: win_shortcut:
src: '{{app_exe}}' src: '{{app_exe}}'