From 5bd9cf5e7fa97556dec648e51b58ee16d80cfd28 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Mon, 20 Dec 2021 20:47:40 +0000 Subject: [PATCH] Add one-liner for session key --- content/posts/ansible-vault-bitwarden.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/content/posts/ansible-vault-bitwarden.md b/content/posts/ansible-vault-bitwarden.md index 92baf11..efc08c9 100644 --- a/content/posts/ansible-vault-bitwarden.md +++ b/content/posts/ansible-vault-bitwarden.md @@ -75,7 +75,13 @@ In this setup, Bitwarden will prompt you for your master password every time you That thing I mentioned before, the ["session key"](https://bitwarden.com/help/article/cli/#using-a-session-key), this is where that comes in. The session key allows Bitwarden to access its credentials without prompting you for your password each time. It works by setting a `$BW_SESSION` environment variable, which future command line invocations can read and unlock the database with. -To configure this, run `bw unlock`. This will prompt you for your master password, and then display a session key environment variable to set. If you set this in the same terminal you run Ansible from, it won't prompt you for your master password any more, as ansible helpfully passes through all environment variables into the relevant password file script. +To configure this, run `bw unlock`. This will prompt you for your master password, and then display a session key environment variable to set. If you set this in the same terminal you run Ansible from, it won't prompt you for your master password any more, as Ansible helpfully passes through all environment variables into the relevant password file script. + +If you want a one-liner to set the session key: + +```bash +export BW_SESSION=$(bw unlock --raw) +``` ## What about the become password?