Fix 1password-cli install on Windows
This commit is contained in:
parent
2286452f5b
commit
b6b18b2b94
@ -18,51 +18,27 @@
|
|||||||
icon: '{{app_exe}},0'
|
icon: '{{app_exe}},0'
|
||||||
|
|
||||||
# CLI
|
# CLI
|
||||||
|
- name: install scoop cli package
|
||||||
|
community.windows.win_scoop:
|
||||||
|
state: present
|
||||||
|
name: 1password-cli
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
cli_dir: '{{ansible_env.LOCALAPPDATA}}\1Password\cli'
|
cli_dir: '{{ansible_env.LOCALAPPDATA}}\1Password\cli'
|
||||||
cli_zip: '{{ansible_env.TEMP}}/op_windows_amd64.zip'
|
|
||||||
- set_fact:
|
|
||||||
cli_exe: '{{cli_dir}}\op.exe'
|
|
||||||
|
|
||||||
- name: check if op already installed
|
- name: create cli directory
|
||||||
win_stat:
|
win_file:
|
||||||
path: '{{cli_exe}}'
|
state: directory
|
||||||
register: cli_stat
|
path: '{{cli_dir}}'
|
||||||
|
|
||||||
- name: get installed op version
|
- name: remove old op executable
|
||||||
when: cli_stat.stat.exists == True
|
win_file:
|
||||||
win_command: '{{cli_exe}} --version'
|
state: absent
|
||||||
register: cli_version
|
path: '{{cli_dir}}\op.exe'
|
||||||
changed_when: false
|
|
||||||
|
|
||||||
- when: cli_stat.stat.exists == True
|
- name: remove old op install directory from user PATH
|
||||||
set_fact:
|
|
||||||
cli_installed_version: '{{cli_version.stdout.strip()}}'
|
|
||||||
|
|
||||||
- name: get list of op releases
|
|
||||||
win_uri:
|
|
||||||
url: https://raw.githubusercontent.com/kbenzie/op-release-scraper/main/op-releases.json
|
|
||||||
return_content: true
|
|
||||||
register: releases
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
latest: '{{releases.json[0]}}'
|
|
||||||
|
|
||||||
- name: download latest op zip archive
|
|
||||||
when: cli_installed_version is not defined or cli_installed_version != latest.version
|
|
||||||
win_get_url:
|
|
||||||
url: '{{latest.downloads.Windows.amd64}}'
|
|
||||||
dest: '{{cli_zip}}'
|
|
||||||
environment: '{{proxy_environment}}'
|
|
||||||
|
|
||||||
- name: unzip op zip archive
|
|
||||||
when: cli_installed_version is not defined or cli_installed_version != latest.version
|
|
||||||
win_unzip:
|
|
||||||
src: '{{cli_zip}}'
|
|
||||||
dest: '{{cli_dir}}'
|
|
||||||
|
|
||||||
- name: add op install directory to user PATH
|
|
||||||
win_path:
|
win_path:
|
||||||
|
state: absent
|
||||||
scope: user
|
scope: user
|
||||||
name: Path
|
name: Path
|
||||||
elements: '{{cli_dir}}'
|
elements: '{{cli_dir}}'
|
||||||
@ -70,7 +46,7 @@
|
|||||||
- name: get op powershell completion script
|
- name: get op powershell completion script
|
||||||
win_command:
|
win_command:
|
||||||
argv:
|
argv:
|
||||||
- '{{ansible_env.LOCALAPPDATA}}/1Password/cli/op.exe'
|
- '{{ansible_env.LOCALAPPDATA}}\Scoop\shims\op.exe'
|
||||||
- completion
|
- completion
|
||||||
- powershell
|
- powershell
|
||||||
register: powershell_completion_script
|
register: powershell_completion_script
|
||||||
|
Loading…
x
Reference in New Issue
Block a user