• Jinja 90.3%
  • JavaScript 9.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Conrad 9148a45435
All checks were successful
Lint + Tag / format (push) Successful in 1m6s
Lint + Tag / tag (push) Successful in 1m18s
fix: updated pipeline
2026-10-12 16:49:01 +07:00
.forgejo/workflows fix: updated pipeline 2026-10-12 16:49:01 +07:00
defaults feat: added sender display name for smtp 2026-09-28 12:28:15 +02:00
files Prettified Code! 2026-09-28 07:36:36 +00:00
meta fix: adjusted for new ansible version 2026-09-28 09:59:46 +02:00
tasks feat: added smtps compatibility 2026-09-28 10:55:30 +02:00
templates feat: added sender display name for smtp 2026-09-28 12:28:15 +02:00
vars feat: added oidc/ sso config 2026-09-28 09:36:07 +02:00
.gitignore feat: added first working version 2026-07-11 14:31:43 +02:00
CHANGELOG.md fix: updated pipeline 2026-10-12 16:49:01 +07:00
LICENSE feat: added first working version 2026-07-11 14:31:43 +02:00
README.md Prettified Code! 2026-09-28 10:28:28 +00:00

Vaultwarden

Deploys a Vaultwarden instance via Docker Compose, routed through Traefik as a reverse proxy.

Requirements

  • Docker
  • community.docker Ansible collection

Variables

Variable Default Description
vaultwarden_instance vaultwarden Unique instance name. Used as Compose project name and container name prefix. Change when running multiple instances on the same host.
vaultwarden_data_path /data/vaultwarden Host path for persistent data (SQLite database, attachments, sends, icons).
vaultwarden_docker_path /docker/vaultwarden Host path for the compose.yml file.
vaultwarden_version 1.37.3 Vaultwarden image tag. Pin to a specific version in production.
vaultwarden_domain ~ Public domain Vaultwarden is served on (no protocol prefix). Required — either this or vaultwarden_port must be set, and it is always required when vaultwarden_traefik is true.
vaultwarden_protocol https Protocol used to build the DOMAIN env var, i.e. {{ vaultwarden_protocol }}://{{ vaultwarden_domain }}. Change to http only for setups intentionally served without TLS.
vaultwarden_port ~ When set, exposes Vaultwarden on this host port (maps to container port 80). Omit when using a reverse proxy.
vaultwarden_traefik true When true, attaches to the traefik_web network and adds Traefik routing labels using vaultwarden_domain.
vaultwarden_admin_token ~ Token required to access the /admin panel. Leave unset to disable the admin panel entirely. See Admin Token.
vaultwarden_extra_hosts {} Extra /etc/hosts entries (hostname: IP), e.g. to reach the SSO provider on a host without NAT hairpin.
vaultwarden_signups_allowed false Whether new user accounts can register themselves without an invite.
vaultwarden_signups_verify false Whether self-registered accounts must verify their email before login. Only relevant when vaultwarden_signups_allowed is true.
vaultwarden_org_events_enabled false Whether organization event logging is enabled.
vaultwarden_invitations_allowed true Whether existing users can invite new members, independent of vaultwarden_signups_allowed.
vaultwarden_emergency_access_allowed true Whether users can grant emergency access to their vault to other accounts.
vaultwarden_email_change_allowed true Whether users are allowed to change their account email address.
vaultwarden_log_level warn Log verbosity. One of: trace, debug, info, warn, error, off.
vaultwarden_mail_conf ~ SMTP mail configuration dict. See Mail.
vaultwarden_sso_conf ~ OpenID Connect (SSO) configuration dict. See SSO.
vaultwarden_uninstall false Stops and removes containers and the compose directory.
vaultwarden_purge false Also removes the data directory. Requires vaultwarden_uninstall: true. Irreversible.

Admin Token

vaultwarden_admin_token is rendered as plain text into the compose file, but Vaultwarden also accepts an Argon2id hash instead — recommended so the raw token never sits on disk. Generate one from a running container:

docker exec -it vaultwarden-app /vaultwarden hash

Copy the resulting hash (including the $argon2id$... prefix) into your inventory:

vaultwarden_admin_token: "$argon2id$v=19$m=..."

Usage

Minimal setup:

vaultwarden_domain: "vault.example.com"

With admin panel and mail enabled:

vaultwarden_domain: "vault.example.com"
vaultwarden_admin_token: "{{ vault_vaultwarden_admin_token }}"
vaultwarden_mail_conf:
  host: smtp.example.com
  username: vaultwarden@example.com
  password: "{{ vault_vaultwarden_smtp_password }}"

Multiple instances on the same host:

# instance 1
vaultwarden_instance: vaultwarden_team_a
vaultwarden_domain: vault-a.example.com
vaultwarden_data_path: /data/vaultwarden_team_a
vaultwarden_docker_path: /docker/vaultwarden_team_a

# instance 2
vaultwarden_instance: vaultwarden_team_b
vaultwarden_domain: vault-b.example.com
vaultwarden_data_path: /data/vaultwarden_team_b
vaultwarden_docker_path: /docker/vaultwarden_team_b

Mail

vaultwarden_mail_conf is a dict. When unset, Vaultwarden cannot send emails (invites, password hints, etc.).

Key Required Default Description
host yes — SMTP server hostname.
username yes — SMTP username.
password yes — SMTP password.
port no 587 SMTP port.
address no username From address. Defaults to username.
security no starttls starttls (587), force_tls (implicit TLS, 465) or off.
from_name no Vaultwarden Sender display name.

SSO

vaultwarden_sso_conf is a dict. When unset, SSO login is disabled and only the standard master-password login is available. When set, SSO_ENABLED is turned on automatically.

Key Required Default Description
authority yes — Base URL of the OIDC provider (auto-discovery is used). No /.well-known/openid-configuration suffix, no trailing /.
client_id yes — OIDC client ID.
client_secret yes — OIDC client secret.
only no false Prevent users from logging in directly without going through SSO.
redirect no same as only Send the web vault's login page straight to the provider, without asking for an email address first. See below.
signups_allowed no true Let SSO logins create accounts (SSO_SIGNUPS_ALLOWED), independent of vaultwarden_signups_allowed.
signups_match_email no true On SSO signup, associate with an existing user if one with a matching email already exists.
allow_unknown_email_verification no false Allow unknown email verification status. Combined with signups_match_email: true, this opens a potential account takeover.
scopes no email profile Additional authorization request scopes (openid is implicit).
authorize_extra_params no unset Extra authorization URL parameters, e.g. access_type=offline&prompt=consent.
pkce no true Use PKCE for the Auth Code flow.
audience_trusted no unset Regex of additional trusted ID token audiences (by default only client_id is trusted).
master_password_policy no unset Dict describing the master password policy (enforceOnLogin, minComplexity, minLength, requireLower, requireNumbers, requireSpecial, requireUpper). Rendered as JSON. enforceOnLogin is not currently supported by Vaultwarden.
auth_only_not_session no false Use SSO only for authentication, not for the session lifecycle.
client_cache_expiration no 0 Discovery endpoint cache duration in seconds (0 disables caching).
debug_tokens no false Log all tokens. Requires vaultwarden_log_level: debug.

Example:

vaultwarden_sso_conf:
  authority: https://auth.example.com
  client_id: "11111"
  client_secret: "{{ vault_vaultwarden_sso_client_secret }}"
  only: true
  master_password_policy:
    enforceOnLogin: false
    minComplexity: 3
    minLength: 12
    requireLower: false
    requireNumbers: false
    requireSpecial: false
    requireUpper: false

Login without the email prompt

The Bitwarden web vault asks for an email address before it starts SSO, even with only: true. With redirect (on by default together with only), the role serves the image's own index.html with an extra script, sso-redirect.js, which sends the plain login page (/, /#/login) straight to /#/sso and on to the provider. Routes with parameters, like the SSO callback and the logins of the desktop app and browser extension, are left alone. The files are re-extracted from the image on every run, so they follow vaultwarden_version.

After SSO, the master password is still needed: it encrypts the vault and the provider never sees it. New accounts set it on their first login.

For Keycloak, use scopes: "email profile offline_access" and an access token lifespan of at least 10 minutes on the client (Vaultwarden's SSO documentation).

Uninstall

To stop and remove all containers and the compose directory:

vaultwarden_uninstall: true

To also wipe all data including the database and vault contents (irreversible):

vaultwarden_uninstall: true
vaultwarden_purge: true

Notes

  • vaultwarden_traefik: true requires an external traefik_web Docker network to already exist — this role does not create it.
  • vaultwarden_data_path is owned by 0:0 (root), mode 0755.
  • vaultwarden_docker_path is owned by 0:0 (root), mode 0700; the rendered compose.yml inside it is mode 0600 since it contains secrets (admin token, SMTP password) in plain text.
  • All secret variables (vaultwarden_admin_token, vaultwarden_mail_conf.password, vaultwarden_sso_conf.client_secret) should be stored in Ansible Vault.