Ansible BuildAnsible Build
Home
Roles
Scripts
Mint System
Chat
GitHub
Home
Roles
Scripts
Mint System
Chat
GitHub
  • N8N role

    • Usage
    • Docs
      • Nginx config
      • Deploy selected config map
n8n logo

N8N role

Deploy N8N container.

Usage

Configure the role.

# https://hub.docker.com/r/n8nio/n8n
n8n_image: n8nio/n8n:1.67.1
n8n_build_image: true # default: false
n8n_hostname: n8n01
n8n_description: Workflow Automation # default: N8N
n8n_state: stopped # default: started
n8n_data_dir: /usr/share/n8n # default: "/usr/share/{{ n8n_hostname }}"
n8n_volume_name: n8n_data01 # default: "{{ n8n_hostname }}"
n8n_network_mode: host # default: "{{ docker_network_name }}"
n8n_config_map:
  - name: prod
    webhook_url: https://n8n.example.com/
  - name: int
    webhook_url: https://n8n-int.example.com/
n8n_timezone: Europe/Paris # default: Europe/Zurich
n8n_db_type: # default: postgresdb
n8n_postgresdb_host: postgres01
n8n_postgresdb_port: # default: "5432"
n8n_postgresdb_database: workflow # default: n8n
n8n_postgresdb_schema: n8n # default: public
n8n_postgresdb_user: workflow # default: n8n
n8n_postgresdb_password: # default: "{{ vault_n8n_postgresdb_password }}"
n8n_secure_cookie: "false" # default: "true"

And include it in your playbook.

- hosts: n8n
  roles:
  - role: n8n

Docs

Nginx config

Setup this Nginx configuration for the n8n01-prod host:

nginx_proxies:
  - src_hostname: n8n.example.com
    dest_hostname: n8n01-prod
    dest_port: 5678
    ssl: true
    options: |
      include /etc/nginx/conf.d/proxy-params.conf;
    locations:
      - path: /rest
        dest_hostname: n8n01-prod
        dest_port: 5678
        options: |
          include /etc/nginx/conf.d/proxy-params.conf;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection $connection_upgrade;
      - path: /webhook
        dest_hostname: n8n01-prod
        dest_port: 5678
        options: |
          include /etc/nginx/conf.d/proxy-params.conf;
          proxy_read_timeout 300;
          proxy_connect_timeout 300;
          proxy_send_timeout 300;

Deploy selected config map

Run ansible-playbook with extra variables and set the cm_name (config map name) with the name of the config map.

task play -i inventories/setup plays/all.yml -t n8n -e "cm_name=int"
Edit this page
Last Updated:
Contributors: Janik von Rotz