From 734ee9bf887b87712f8c4504b0299b09ffcf0bf5 Mon Sep 17 00:00:00 2001 From: Lorentz Administrator Date: Mon, 9 Mar 2026 23:28:43 -0400 Subject: [PATCH] Add playbooks/ntfy.yml --- playbooks/ntfy.yml | 73 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 playbooks/ntfy.yml diff --git a/playbooks/ntfy.yml b/playbooks/ntfy.yml new file mode 100644 index 0000000..9759885 --- /dev/null +++ b/playbooks/ntfy.yml @@ -0,0 +1,73 @@ +- name: Deploy ntfy + hosts: docker_hosts + become: true + + vars: + stack_dir: /opt/stacks/ntfy + + pre_tasks: + - name: Fail if fqdn is not set + fail: + msg: "fqdn is required. Pass it via -e fqdn=..." + when: fqdn is not defined or fqdn | length == 0 + + tasks: + - name: Create stack directory + ansible.builtin.file: + path: "{{ stack_dir }}" + state: directory + mode: '0755' + + - name: Ensure pangolin network exists + community.docker.docker_network: + name: pangolin + state: present + + - name: Deploy compose.yml + ansible.builtin.copy: + dest: "{{ stack_dir }}/compose.yml" + mode: '0644' + content: | + services: + ntfy: + image: binwiederhier/ntfy:latest + container_name: ntfy + restart: unless-stopped + command: serve + environment: + NTFY_BASE_URL: https://{{ fqdn }} + NTFY_BEHIND_PROXY: "true" + NTFY_CACHE_FILE: /var/cache/ntfy/cache.db + NTFY_AUTH_FILE: /var/lib/ntfy/auth.db + NTFY_AUTH_DEFAULT_ACCESS: deny-all + NTFY_ATTACHMENT_CACHE_DIR: /var/cache/ntfy/attachments + volumes: + - ntfy-cache:/var/cache/ntfy + - ntfy-auth:/var/lib/ntfy + expose: + - "80" + healthcheck: + test: ["CMD-SHELL", "wget -q --tries=1 http://localhost:80/v1/health -O - | grep -Eo '\"healthy\"\\s*:\\s*true' || exit 1"] + interval: 60s + timeout: 10s + retries: 3 + start_period: 10s + networks: + - pangolin + + volumes: + ntfy-cache: + ntfy-auth: + + networks: + pangolin: + external: true + + - name: Pull images + community.docker.docker_compose_v2_pull: + project_src: "{{ stack_dir }}" + + - name: Deploy stack + community.docker.docker_compose_v2: + project_src: "{{ stack_dir }}" + state: present