Add ntfy role
Installs and configures the ntfysh server to enable notifications.
This commit is contained in:
parent
1e0643352d
commit
32b1b13ef4
11 changed files with 253 additions and 0 deletions
38
roles/ntfy/tasks/main.yml
Normal file
38
roles/ntfy/tasks/main.yml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
- name: Ensure target directory exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ ntfy_upstream_file_dir }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
become: yes
|
||||
|
||||
- name: Move ntfy configuration file to target dir
|
||||
ansible.builtin.template:
|
||||
src: "server.yml.j2"
|
||||
dest: "{{ ntfy_upstream_file_dir }}/server.yml"
|
||||
become: yes
|
||||
notify: "update ntfy upstream"
|
||||
|
||||
## install ntfy container
|
||||
- name: Check upstream status
|
||||
community.docker.docker_container_exec:
|
||||
container: "{{ caddy_container_id }}"
|
||||
command: >
|
||||
curl localhost:2019/id/{{ stack_name }}_upstream/
|
||||
register: result
|
||||
changed_when: (result.stdout | from_json) != (lookup('template', 'upstream.json.j2') | from_yaml)
|
||||
become: yes
|
||||
notify: "update ntfy upstream"
|
||||
|
||||
- name: Deploy ntfy to swarm
|
||||
community.general.docker_stack:
|
||||
name: "{{ stack_name }}"
|
||||
state: present
|
||||
prune: yes
|
||||
compose:
|
||||
- "{{ stack_compose }}"
|
||||
become: yes
|
||||
tags:
|
||||
- docker-swarm
|
||||
notify: "update ntfy upstream"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue