some more roles

This commit is contained in:
Christopher Beckmann
2024-03-22 16:15:03 +01:00
parent 0506eb2665
commit 54f1ca03cd
6 changed files with 86 additions and 11 deletions

View File

@@ -1,7 +1,46 @@
# Check if bw can be run
# Run bw --version
- name: Install Bitwarden SDK
pip:
name: bitwarden-sdk
# Run curl https://vault.bitwarden.com/download/?app=cli&platform=linux
# Check for Version String -> Update if newer
- name: Check if Bitwarden CLI is installed
command: bw --version
register: installed
changed_when: no
ignore_errors: true
# Add configuration files
- name: Check for newest version
shell: |
curl 'https://vault.bitwarden.com/download/?app=cli&platform=linux' -si | grep -oP 'location: .*bw-linux-\K.*\.zip' | cut -d . -f -3
register: current
changed_when: no
when: installed is success
ignore_errors: true
- name: Print return information from the installed Bitwarden
ansible.builtin.debug:
var: installed
verbosity: 2
- name: Print return information from the newest Bitwarden CLI version
ansible.builtin.debug:
var: current
verbosity: 2
- name: Install Bitwarden CLI
become: true
when: installed is failed or installed.stdout is version(current.stdout, '<')
shell: |
curl -O -J -L "https://vault.bitwarden.com/download/?app=cli&platform=linux"
rm -rf /usr/bin/bw
unzip bw-*.zip -d /usr/bin/
rm -rf bw-*.zip
- name: Configure Bitwarden CLI
shell: |
bw config server https://bitwarden.cbeck.tech
# - name: Test
# ansible.builtin.debug:
# msg: >-
# {{ lookup('community.general.bitwarden', 'SySS', field='password') }}