listmonk Ansible role
https://listmonk.app/
- Jinja 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| defaults | ||
| meta | ||
| tasks | ||
| templates | ||
| CHANGELOG.md | ||
| README.md | ||
listmonk
Deploys listmonk — a self-hosted newsletter and mailing list manager — via Docker Compose, backed by PostgreSQL.
Requirements
- Docker
community.dockerAnsible collection (>=5.2.0)
Variables
| Variable | Default | Description |
|---|---|---|
listmonk_instance |
listmonk |
Unique instance name. Used as Compose project name and container names. |
listmonk_data_path |
/data/listmonk |
Host path for persistent data (PostgreSQL data, uploaded media). |
listmonk_docker_path |
/docker/listmonk |
Host path for the Compose file. |
listmonk_image |
listmonk/listmonk |
listmonk image. Override for a private mirror/registry. |
listmonk_version |
v6.2.0 |
listmonk image tag. Pin to a specific version in production. |
listmonk_pg_version |
17-alpine |
PostgreSQL image tag. Pin to a specific version in production. |
listmonk_domain |
~ |
Public domain. When set, enables Traefik routing labels and attaches to the traefik_web network. |
listmonk_traefik_certresolver |
default |
Traefik certificate resolver to use for listmonk_domain. |
listmonk_port |
~ |
When set, exposes listmonk on this host port (maps to container port 9000). Omit when using listmonk_domain. |
listmonk_pg_user |
listmonk |
PostgreSQL user, password owner and database name (single value used for all three). |
listmonk_pg_pass |
~ |
PostgreSQL password. Required. Generate with: openssl rand -hex 32 |
listmonk_admin_user |
~ |
Initial Super Admin user name, created on the first start only. Must be set together with the password. |
listmonk_admin_password |
~ |
Initial Super Admin password. Must be set together with the user name. |
listmonk_timezone |
Europe/Berlin |
Container timezone (scheduled campaigns, log timestamps). |
listmonk_extra_env |
{} |
Dict of extra environment variables for the app container (any LISTMONK_<section>__<key> config value). |
listmonk_uninstall |
false |
Stops and removes containers and the compose directory. |
listmonk_purge |
false |
Also removes the data directory (database and uploads). Requires listmonk_uninstall: true. Irreversible. |
Usage
Minimal setup:
listmonk_pg_pass: "{{ vault_listmonk_pg_pass }}"
listmonk_domain: "newsletter.example.com"
Creating the Super Admin on the first start instead of on the first visit of the web UI:
listmonk_admin_user: "admin"
listmonk_admin_password: "{{ vault_listmonk_admin_password }}"
Uninstall
To stop and remove all containers and the compose directory:
listmonk_uninstall: true
Add listmonk_purge: true to also delete the database and uploads.
Notes
- Configuration lives in two places. Everything from
config.toml(address, database) is passed asLISTMONK_*env vars; the container starts with--config ''so no config file is read. Everything else - root URL, SMTP servers, bounce handling, media storage, privacy settings - lives in the database and is set in the web UI under Settings. Set Settings → General → Root URL tohttps://<listmonk_domain>after the first start, else links in mails point athttp://localhost:9000. - Schema setup and upgrades are automatic. The container runs
--install --idempotent(creates the schema on an empty database only) and--upgrade(runs migrations after an image bump) before starting. - Admin credentials are first-start only.
listmonk_admin_user/listmonk_admin_passwordare only read while the database is empty. Changing them later does nothing; change the password in the UI. - Uploads.
{{ listmonk_data_path }}/uploadsis mounted at/listmonk/uploads, listmonk's default media path for the filesystem provider. - Postgres is only reachable on the internal Docker network — no host port is published.
- Containers are not proxied by Traefik unless
listmonk_domainis set — it must already have atraefik_webnetwork and a matchingcertresolver(see thetraefikrole).