fix(user/secrets/bw): use environment variables
Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
parent
01adcb99d4
commit
1866b1e4c4
2 changed files with 16 additions and 28 deletions
|
@ -11,29 +11,13 @@
|
||||||
path: ~/.local/bin/bw
|
path: ~/.local/bin/bw
|
||||||
mode: u+x
|
mode: u+x
|
||||||
|
|
||||||
- name: Run the CLI to create initial file
|
- name: Create directories for different Bitwarden accounts
|
||||||
ansible.builtin.command:
|
ansible.builtin.file:
|
||||||
# See https://github.com/bitwarden/clients/issues/6144
|
path: "~/.config/Bitwarden CLI/{{ item }}"
|
||||||
cmd: "~/.local/bin/bw --version"
|
state: directory
|
||||||
creates: ~/.config/Bitwarden CLI/data.json
|
|
||||||
|
|
||||||
- name: Create data stores for specific deployments
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: ~/.config/Bitwarden CLI/data.json
|
|
||||||
dest: ~/.config/Bitwarden CLI/{{ item }}.json
|
|
||||||
mode: 0600
|
mode: 0600
|
||||||
force: false
|
owner: "{{ target_user }}"
|
||||||
remote_src: true
|
group: "{{ target_user }}"
|
||||||
loop:
|
loop:
|
||||||
- vault.bitwarden.com
|
- vault.bitwarden.com
|
||||||
- vault.mfocko.xyz
|
- vault.mfocko.xyz
|
||||||
|
|
||||||
- name: Symlink to the self-hosted deployment
|
|
||||||
ansible.builtin.file:
|
|
||||||
src: ~/.config/Bitwarden CLI/vault.mfocko.xyz.json
|
|
||||||
path: ~/.config/Bitwarden CLI/data.json
|
|
||||||
force: true
|
|
||||||
state: link
|
|
||||||
# - name: Switch the server on the self-hosted “login”
|
|
||||||
# ansible.builtin.command:
|
|
||||||
# cmd: bw config server https://vault.mfocko.xyz
|
|
||||||
|
|
|
@ -64,16 +64,20 @@ export SDKMAN_DIR="/opt/sdkman"
|
||||||
eval "$(bw completion --shell zsh); compdef _bw bw;"
|
eval "$(bw completion --shell zsh); compdef _bw bw;"
|
||||||
|
|
||||||
function bwu() {
|
function bwu() {
|
||||||
local VAULT=$(readlink ~/.config/Bitwarden\ CLI/data.json | cut -d'/' -f6 | cut -d'.' -f-3)
|
local VAULT=$(basename $BITWARDENCLI_APPDATA_DIR)
|
||||||
local PASS=$(yad --text "Master password for Bitwarden Vault @ $VAULT:" --center --button "yad-ok" --entry --hide-text)
|
local PASS=$(yad --text "Master password for Bitwarden Vault @ $VAULT:" --center --button "yad-ok" --entry --hide-text)
|
||||||
export BW_SESSION=$(bw unlock --raw "$PASS")
|
export BW_SESSION=$(bw unlock --raw "$PASS")
|
||||||
}
|
}
|
||||||
|
|
||||||
# alias bwu='export BW_SESSION="$(bw unlock --raw)"'
|
|
||||||
alias bwl='export BW_SESSION='
|
alias bwl='export BW_SESSION='
|
||||||
|
|
||||||
alias bwrh='ln -sf $HOME/.config/Bitwarden\ CLI/{vault.bitwarden.com,data}.json'
|
function bwrh() {
|
||||||
alias bwvps='ln -sf $HOME/.config/Bitwarden\ CLI/{vault.mfocko.xyz,data}.json'
|
export BITWARDENCLI_APPDATA_DIR="$HOME/.config/Bitwarden CLI/vault.bitwarden.com"
|
||||||
|
}
|
||||||
|
function bwvps() {
|
||||||
|
export BITWARDENCLI_APPDATA_DIR="$HOME/.config/Bitwarden CLI/vault.mfocko.xyz"
|
||||||
|
}
|
||||||
|
bwvps
|
||||||
|
|
||||||
function gen_pass() {
|
function gen_pass() {
|
||||||
LENGTH=12
|
LENGTH=12
|
||||||
|
|
Loading…
Reference in a new issue