n8n Ansible role https://n8n.io/
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-14 01:42:49 +01:00
.forgejo/workflows feat: initial version 2026-11-07 15:47:58 +01:00
defaults feat: initial version 2026-11-07 15:47:58 +01:00
meta feat: initial version 2026-11-07 15:47:58 +01:00
tasks [no ci] quick fix on the asserts 2026-11-07 16:47:24 +01:00
templates feat: initial version 2026-11-07 15:47:58 +01:00
.gitignore feat: initial version 2026-11-07 15:47:58 +01:00
CHANGELOG.md fix: fixed issue with versioning 2026-11-14 01:42:49 +01:00
LICENSE feat: initial version 2026-11-07 15:47:58 +01:00
README.md feat: initial version 2026-11-07 15:47:58 +01:00

n8n

Deploys an n8n instance (workflow automation) via Docker Compose, routed through Traefik as a reverse proxy. Data lives in SQLite under n8n_data_path.

Requirements

  • Docker
  • Traefik on the traefik_web network with a websecure entrypoint (when n8n_traefik is true)
  • community.docker Ansible collection

Variables

Variable Default Description
n8n_instance n8n Unique instance name. Used as Compose project name and container name prefix. Change when running multiple instances on the same host.
n8n_data_path /data/n8n Host path for persistent data: data/ (n8n home: SQLite database, config with the encryption key) and files/ (mounted at /files).
n8n_docker_path /docker/n8n Host path for the compose.yml file.
n8n_version 2.46.6 n8n image tag. Pin to a specific version in production.
n8n_domain ~ Public domain n8n is served on (no protocol prefix). Sets the Traefik rule, editor URL and webhook URL. Required when n8n_traefik is true.
n8n_port ~ When set, exposes n8n on this host port, bound to 127.0.0.1. Either this or n8n_domain must be set.
n8n_traefik true When true, attaches to the traefik_web network and adds Traefik routing labels using n8n_domain.
n8n_traefik_certresolver default Traefik certificate resolver.
n8n_timezone Europe/Berlin Timezone for schedule triggers and date functions.
n8n_encryption_key ~ Key for stored credentials. See Encryption key.
n8n_mail_conf ~ SMTP mail configuration dict. See Mail.
n8n_env {} Additional environment variables, overriding the role's own values (e.g. {N8N_LOG_LEVEL: debug}).
n8n_uninstall false Stops and removes the container and the compose directory.
n8n_purge false Also removes the data directory (database, credentials, encryption key). Requires n8n_uninstall: true. Irreversible.

Telemetry, personalization survey, hiring banner, usage page and version notifications are switched off.

Encryption key

n8n encrypts stored credentials. Without n8n_encryption_key it generates a key on first start into <n8n_data_path>/data/config; a backup of the data directory then includes it. Set the variable (vaulted) to be able to restore the database without that file. Never change the key of an existing instance - stored credentials become unreadable. To keep a generated key, copy encryptionKey from that file into the variable.

Mail

Needed for user invites and password resets.

n8n_mail_conf:
  host: smtp.example.com
  username: n8n@example.com
  password: secret
  # Optional:
  address: n8n@example.com # sender, defaults to username
  security: force_tls # force_tls (implicit TLS, default port 465), starttls (587) or off
  port: 465

Usage

- hosts: web01
  become: true
  roles:
    - role: n8n
      vars:
        n8n_domain: n8n.example.com

The first visitor creates the owner account - open the editor right after the first deploy.

Not included

  • SSO (OIDC/SAML) - an n8n Enterprise feature.
  • PostgreSQL and queue mode (workers) - SQLite is enough for a single instance.