Files
iac-ansible-public/roles/vaultwarden/tasks/main.yml
tomas.limpinho 2b060b27f0 bw
2025-10-30 13:33:00 +00:00

33 lines
831 B
YAML

- name: Instalar dependências (curl, unzip, jq)
become: true
apt:
name:
- curl
- unzip
- jq
state: present
update_cache: true
- name: Instalar Bitwarden CLI
become: true
shell: |
curl -L https://github.com/bitwarden/cli/releases/latest/download/bw-linux.zip -o bw.zip
unzip bw.zip
chmod +x bw
mv bw /usr/local/bin/bw
args:
creates: /usr/local/bin/bw
- name: Fazer login no Bitwarden
shell: bw login {{ bw_email }} --password {{ bw_password }}
register: bw_login
no_log: true
- name: Desbloquear cofre e guardar sessão
shell: bw unlock --password {{ bw_password }} --raw
register: bw_session
no_log: true
- name: Exportar sessão para ambiente local
shell: echo "export BW_SESSION={{ bw_session.stdout }}" >> /etc/profile.d/bw-session.sh
become: true