From 3b312e6f9a6f57e82db2ffd9285389864017666c Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Sat, 29 Jul 2023 11:33:49 +0100 Subject: [PATCH] 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. --- roles/1password/tasks/Windows.yaml | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/roles/1password/tasks/Windows.yaml b/roles/1password/tasks/Windows.yaml index 53416c8..6c4b4a2 100644 --- a/roles/1password/tasks/Windows.yaml +++ b/roles/1password/tasks/Windows.yaml @@ -11,36 +11,21 @@ path: '{{app_exe}}' 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 + when: not app_stat.stat.exists win_get_url: url: https://downloads.1password.com/win/1PasswordSetup-latest.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 - when: installed_version is not defined or installed_version != installer_version + when: not app_stat.stat.exists win_command: '{{installer_exe}}' +- name: remove installer + win_file: + path: '{{installer_exe}}' + state: absent + - name: create start menu shortcut win_shortcut: src: '{{app_exe}}'