From a31914a86f269e28633b0877378403a06a078507 Mon Sep 17 00:00:00 2001 From: lorentz Date: Sun, 19 Apr 2026 22:05:19 -0400 Subject: [PATCH] Add playbooks/n8n.yml --- playbooks/n8n.yml | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 playbooks/n8n.yml diff --git a/playbooks/n8n.yml b/playbooks/n8n.yml new file mode 100644 index 0000000..1ebd824 --- /dev/null +++ b/playbooks/n8n.yml @@ -0,0 +1,50 @@ +- name: Deploy n8n + hosts: all + become: true + + vars: + stack_dir: "/opt/stacks/{{ stack_name }}" + + pre_tasks: + - name: Fail if stack_name is not set + fail: + msg: "stack_name is required" + when: stack_name is not defined or stack_name | length == 0 + + - name: Fail if n8n_url is not set + fail: + msg: "n8n_url is required" + when: n8n_url is not defined or n8n_url | length == 0 + + - name: Fail if encryption key is not set + fail: + msg: "n8n_encryption_key is required" + when: n8n_encryption_key is not defined or n8n_encryption_key | length == 0 + + tasks: + - name: Ensure stack directory exists + file: + path: "{{ stack_dir }}" + state: directory + mode: "0755" + + - name: Ensure pangolin network exists + community.docker.docker_network: + name: pangolin + state: present + + - name: Render .env + template: + src: templates/n8n.env.j2 + dest: "{{ stack_dir }}/.env" + mode: "0600" + + - name: Render compose file + template: + src: templates/n8n-compose.yml.j2 + dest: "{{ stack_dir }}/compose.yml" + + - name: Deploy stack + command: docker compose up -d + args: + chdir: "{{ stack_dir }}" \ No newline at end of file