47 lines
1.2 KiB
YAML
47 lines
1.2 KiB
YAML
- name: Install Bitwarden SDK
|
|
pip:
|
|
name: bitwarden-sdk
|
|
|
|
- name: Check if Bitwarden CLI is installed
|
|
command: bw --version
|
|
register: installed
|
|
changed_when: no
|
|
ignore_errors: true
|
|
|
|
- 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') }}
|
|
|