some more roles
This commit is contained in:
@@ -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') }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user