Add op role for Linux, macOS, and Windows

This commit is contained in:
Kenneth Benzie 2022-06-05 20:38:48 +01:00
parent 60a147124f
commit 651909ff71
6 changed files with 52 additions and 0 deletions

View File

@ -10,6 +10,7 @@
- role: ag - role: ag
- role: bat - role: bat
- role: git - role: git
- role: op
- role: tree - role: tree
- role: llvm - role: llvm

View File

@ -8,6 +8,7 @@
- role: ag - role: ag
- role: git - role: git
- role: op
- role: tree - role: tree
- role: llvm - role: llvm

View File

@ -0,0 +1,5 @@
---
- name: install homebrew package
homebrew_cask:
name: 1password-cli
state: latest

View File

@ -0,0 +1,38 @@
---
- name: get html of latest versions
uri:
url: https://raw.githubusercontent.com/kbenzie/op-release-scraper/main/op-releases.json
register: op_releases
- when: ansible_machine == "x86"
set_fact: {op_arch: '386'}
- when: ansible_machine == "x86_64"
set_fact: {op_arch: 'amd64'}
- when: ansible_machine == "arm"
set_fact: {op_arch: 'arm'}
- when: ansible_machine == "arm64"
set_fact: {op_arch: 'arm64'}
- set_fact:
op_zip_url: '{{op_releases.json[0].downloads.Linux[op_arch]}}'
- name: create directory for downloaded package
file:
state: directory
dest: ~/.local/src/op
- name: download latest release package
get_url:
url: '{{op_zip_url}}'
dest: ~/.local/src/op/op.zip
- name: extract zip package
unarchive:
src: ~/.local/src/op/op.zip
dest: ~/.local/src/op
- name: create symbolic links
file:
src: ~/.local/src/op/op
dest: ~/.local/bin/op
state: link

View File

@ -0,0 +1,5 @@
---
- name: install chocolatey package
win_chocolatey:
name: op
state: latest

2
roles/op/tasks/main.yaml Normal file
View File

@ -0,0 +1,2 @@
---
- include_tasks: '{{ansible_os_family}}.yaml'