From 0524406120927e4357f08dcad434422d55bae6aa Mon Sep 17 00:00:00 2001 From: Toben Archer Date: Sat, 23 Jan 2021 15:01:19 +0000 Subject: [PATCH 1/3] n8n Role created and works. Now I just need to finish out the documentation. --- nas.yml | 5 +++++ roles/n8n/defaults/main.yml | 13 +++++++++++++ roles/n8n/tasks/main.yml | 29 +++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 roles/n8n/defaults/main.yml create mode 100644 roles/n8n/tasks/main.yml diff --git a/nas.yml b/nas.yml index d28ac26c..91c438d7 100644 --- a/nas.yml +++ b/nas.yml @@ -98,6 +98,11 @@ - lidarr when: (lidarr_enabled | default(False)) + - role: n8n + tags: + - n8n_enabled + when: (n8n_enabled | default(False)) + - role: netdata tags: - netdata diff --git a/roles/n8n/defaults/main.yml b/roles/n8n/defaults/main.yml new file mode 100644 index 00000000..f513a451 --- /dev/null +++ b/roles/n8n/defaults/main.yml @@ -0,0 +1,13 @@ +n8n_enabled: false + +# Networking +n8n_available_externally: "false" +n8n_port: 5678 + +# Directories +n8n_data_directory: "{{ docker_home }}/n8n" + + +# Security +n8n_basic_auth_user: "n8n_user" +n8n_basic_auth_password: "n8n_change_me" diff --git a/roles/n8n/tasks/main.yml b/roles/n8n/tasks/main.yml new file mode 100644 index 00000000..3dbf0553 --- /dev/null +++ b/roles/n8n/tasks/main.yml @@ -0,0 +1,29 @@ +--- +- name: Create n8n Directory + file: + path: "{{ item }}" + state: directory + with_items: + - "{{ n8n_data_directory }}" + +- name: n8n Docker Container + docker_container: + name: n8n + image: n8nio/n8n + pull: true + ports: + - "{{ n8n_port }}:5678" + volumes: + - "{{ n8n_data_directory }}:/home/node/.n8n:rw" + - "/etc/timezone:/etc/timezone:ro" + restart_policy: unless-stopped + memory: 1g + env: + N8N_BASIC_AUTH_ACTIVE: "true" + N8N_BASIC_AUTH_USER: "{{ n8n_basic_auth_user }}" + N8N_BASIC_AUTH_PASSWORD: "{{ n8n_basic_auth_password }}" + labels: + traefik.backend: "n8n" + traefik.frontend.rule: "Host:n8n.{{ ansible_nas_domain }}" + traefik.enable: "{{ n8n_available_externally }}" + traefik.port: "5678" From f0a36fef7ef6c002e8af186f879950d99949b628 Mon Sep 17 00:00:00 2001 From: Toben Archer Date: Sat, 23 Jan 2021 15:15:07 +0000 Subject: [PATCH 2/3] Docs included I've also updated the configuration for the new traefik configuration. --- docs/applications/n8n.md | 14 ++++++++++++++ docs/configuration/application_ports.md | 1 + roles/n8n/tasks/main.yml | 8 +++++--- 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 docs/applications/n8n.md diff --git a/docs/applications/n8n.md b/docs/applications/n8n.md new file mode 100644 index 00000000..c0f47016 --- /dev/null +++ b/docs/applications/n8n.md @@ -0,0 +1,14 @@ +# Nodemation (n8n) + +Homepage: [ihttps://n8n.io](https://n8n.io) + + +## Usage + +Set `n8n_enabled: true` in your `inventories//nas.yml` file. + +n8n is secured by default, he user and password can be set with: +* n8n_basic_auth_user: "" +* n8n_basic_auth_password: "" + +The default for these is "n8n_user" and "n8n_change_me" respectively, it is recommended to change these. diff --git a/docs/configuration/application_ports.md b/docs/configuration/application_ports.md index c06d693a..f41686ba 100644 --- a/docs/configuration/application_ports.md +++ b/docs/configuration/application_ports.md @@ -39,6 +39,7 @@ By default, applications can be found on the ports listed below. | Mosquitto | 9001 | Websocket | | Mylar | 8585 | HTTP | | MyMediaForAlexa | 52051 | | +| n8n | 5678 | HTTP | | Netdata | 19999 | | | Nextcloud | 8080 | | | NZBGet | 6789 | | diff --git a/roles/n8n/tasks/main.yml b/roles/n8n/tasks/main.yml index 3dbf0553..cc9d85b9 100644 --- a/roles/n8n/tasks/main.yml +++ b/roles/n8n/tasks/main.yml @@ -23,7 +23,9 @@ N8N_BASIC_AUTH_USER: "{{ n8n_basic_auth_user }}" N8N_BASIC_AUTH_PASSWORD: "{{ n8n_basic_auth_password }}" labels: - traefik.backend: "n8n" - traefik.frontend.rule: "Host:n8n.{{ ansible_nas_domain }}" traefik.enable: "{{ n8n_available_externally }}" - traefik.port: "5678" + traefik.http.routers.n8n.rule: "Host(`{{ n8n_hostname }}.{{ ansible_nas_domain }}`)" + traefik.http.routers.n8n.tls.certresolver: "letsencrypt" + traefik.http.routers.n8n.tls.domains[0].main: "{{ ansible_nas_domain }}" + traefik.http.routers.n8n.domains[0].sans: "*.{{ ansible_nas_domain }}" + traefik.http.services.gitea.loadbalancer.server.port: "5678" From b34583dbe9f707d84342418b9603681ceeab9ae0 Mon Sep 17 00:00:00 2001 From: Toben Archer Date: Sat, 23 Jan 2021 21:37:10 +0000 Subject: [PATCH 3/3] Missed some bits. --- README.md | 1 + roles/n8n/defaults/main.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index afd3c3c3..121033f6 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ Ansible config and a bunch of Docker containers. * [Mosquitto](https://mosquitto.org) - An open source MQTT broker * [Mylar](https://github.com/evilhero/mylar) - An automated Comic Book downloader (cbr/cbz) for use with SABnzbd, NZBGet and torrents * [MyMediaForAlexa](https://www.mymediaalexa.com/) - Lets you stream your music collection to your alexa device +* [n8n](https://n8n.io") - Nodemation, a node based workflow and automation service like IFTTT. * [Netdata](https://my-netdata.io/) - An extremely comprehensive system monitoring solution * [Nextcloud](https://nextcloud.com/) - A self-hosted Dropbox alternative * [NZBget](https://nzbget.net/) - The most efficient usenet downloader diff --git a/roles/n8n/defaults/main.yml b/roles/n8n/defaults/main.yml index f513a451..67c6b7fe 100644 --- a/roles/n8n/defaults/main.yml +++ b/roles/n8n/defaults/main.yml @@ -3,6 +3,7 @@ n8n_enabled: false # Networking n8n_available_externally: "false" n8n_port: 5678 +n8n_hostname: "n8n" # Directories n8n_data_directory: "{{ docker_home }}/n8n"