Compare commits

..
2 Commits
Author SHA1 Message Date
ashish a96a14e261 Added ntfy router to docker compose 2023-11-19 04:53:09 -06:00
ashish d2f30faa5e Added ntfy routing 2023-11-19 04:52:07 -06:00
5 changed files with 13 additions and 38 deletions

No files matched your search

-24
View File
@@ -39,30 +39,6 @@
path: '{{docker_build_dir.path}}'
state: absent
- name: Create temporary Docker build directory for broadcast-ntfy-router
ansible.builtin.tempfile:
state: directory
register: docker_build_dir
- name: Copy Docker build directory
ansible.builtin.copy:
src: ntfy_router/
dest: '{{docker_build_dir.path}}'
mode: preserve
- name: Build broadcast-ntfy-router Docker image
ansible.builtin.docker_image:
build:
path: '{{docker_build_dir.path}}'
name: broadcast-ntfy-router
tag: latest
source: build
force_source: true
state: present
- name: Remove temporary Docker build directory
become: true
ansible.builtin.file:
path: '{{docker_build_dir.path}}'
state: absent
- name: Read homelab config
ansible.builtin.slurp:
src: '{{ansible_user_dir}}/.homelab.json'
+6 -5
View File
@@ -1,4 +1,10 @@
notification:
test2:
system:
title: '(?<=\[).+(?=\])'
message:
title: '^.+(?=\s\[)'
message: '[^\n]+$'
jenkins:
system:
title: '.*'
@@ -10,11 +16,6 @@ notification:
message:
title: '^.+(?=\s\[)'
message: '[^\n]+$'
Dsatp58_alerts:
system:
title: '(?<=\s)[\w.]+'
message:
message: '[^\n]+(?=\n---------)'
call:
call_ashish:
caller:
+1 -1
View File
@@ -37,7 +37,7 @@ class RabbitMQPublisher:
def send_notification(self, system: str, user: str, priority: str, message: str) -> None:
self._publish(f'notification.{system}.{user}.{priority}', message)
def send_call(self, caller: str, user: str, message: str) -> None:
def send_call() -> None:
self._publish(f'call.{caller}.{user}', json.dumps({
'ringtone': {
'filename': 'Magic.mp3',
+5 -5
View File
@@ -45,11 +45,11 @@ class NtfyRouter:
def route_message(self, topic: str, title: str, message: str):
if topic in self._formatters['notification']:
notification_args = {notification_arg: self._formatters['notification'][topic][notification_arg](topic=topic, title=title, message=message) for notification_arg in self._formatters['notification'][topic]}
self._rabbitmq_publisher.send_notification(user='ashish', priority='high', **notification_args)
elif topic in self._formatters['call']:
call_args = {call_arg: self._formatters['call'][topic][call_arg](topic=topic, title=title, message=message) for call_arg in self._formatters['call'][topic]}
self._rabbitmq_publisher.send_call(**call_args)
notification_args = {notification_arg: self._formatters['notification'][topic][output](topic=topic, title=title, message=message) for notification_arg in self._formatters['notification'][topic]}
self._send_notification(user='ashish', priority='high', **notification_args)
elif topic in self._call_topics:
call_args = {call_arg: self._formatters['call'][topic][output](topic=topic, title=title, message=message) for call_arg in self._formatters['call'][topic]}
self._send_call(user='ashish', **call_args)
async def start(self, rabbitmq_host: str, rabbitmq_port: int):
self._ntfy_subscriber = NtfySubscriber([topic for message_type in self._formatters for topic in self._formatters[message_type]])
+1 -3
View File
@@ -12,9 +12,7 @@
mode: preserve
- name: Docker Compose down Broadcast
environment:
SERVER_IP: '{{ansible_default_ipv4.address}}'
community.docker.docker_compose_v2:
community.docker.docker_compose:
project_name: broadcast
project_src: '{{docker_compose_dir.path}}'
state: absent