Add playbooks/n8n.yml
This commit is contained in:
parent
1483d66e4f
commit
a31914a86f
1 changed files with 50 additions and 0 deletions
50
playbooks/n8n.yml
Normal file
50
playbooks/n8n.yml
Normal file
|
|
@ -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 }}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue