Compare commits

...

3 Commits

3 changed files with 18 additions and 42 deletions

View File

@ -2,4 +2,4 @@
collections_path = collections
library = library
roles_path = roles
stdout_callback = yaml
result_format = yaml

View File

@ -93,7 +93,7 @@ function Get-GitRemoteHeadBranch {
$result = Run-Command -command $command -working_directory $dest
if ($result.rc -ne 0) {
$module.FailJson("Could not determine the default HEAD branch of remote: $remote" ` +
"$result.stdout $result.stderr")
$result.stderr)
}
return $result.stdout.Trim().Replace("$remote/", '')
}

View File

@ -18,51 +18,27 @@
icon: '{{app_exe}},0'
# CLI
- name: install scoop cli package
community.windows.win_scoop:
state: present
name: 1password-cli
- set_fact:
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
win_stat:
path: '{{cli_exe}}'
register: cli_stat
- name: create cli directory
win_file:
state: directory
path: '{{cli_dir}}'
- name: get installed op version
when: cli_stat.stat.exists == True
win_command: '{{cli_exe}} --version'
register: cli_version
changed_when: false
- name: remove old op executable
win_file:
state: absent
path: '{{cli_dir}}\op.exe'
- when: cli_stat.stat.exists == True
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
- name: remove old op install directory from user PATH
win_path:
state: absent
scope: user
name: Path
elements: '{{cli_dir}}'
@ -70,7 +46,7 @@
- name: get op powershell completion script
win_command:
argv:
- '{{ansible_env.LOCALAPPDATA}}/1Password/cli/op.exe'
- '{{ansible_env.LOCALAPPDATA}}\Scoop\shims\op.exe'
- completion
- powershell
register: powershell_completion_script