From cbe9d68ff92484b4219c862067bd4cd3404134f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20G=C3=BCnther?= Date: Wed, 5 Oct 2022 15:30:59 +0200 Subject: [PATCH] ntfy_client: Install curl wrapper for ntfy For now compatible with curl-gotify. Since ntfy supports more features like clickable links, attachments... maybe this script should support flags in the future. --- playbooks/avalon.yml | 1 + roles/ntfy_client/tasks/main.yml | 12 ++++++++++++ roles/ntfy_client/templates/curl-ntfy.j2 | 5 +++++ 3 files changed, 18 insertions(+) create mode 100644 roles/ntfy_client/tasks/main.yml create mode 100644 roles/ntfy_client/templates/curl-ntfy.j2 diff --git a/playbooks/avalon.yml b/playbooks/avalon.yml index 6a1ce4f..4d1e678 100644 --- a/playbooks/avalon.yml +++ b/playbooks/avalon.yml @@ -52,3 +52,4 @@ - { role: coturn } - { role: hedgedoc } - { role: ntfy_server } + - { role: ntfy_client } diff --git a/roles/ntfy_client/tasks/main.yml b/roles/ntfy_client/tasks/main.yml new file mode 100644 index 0000000..dc02a27 --- /dev/null +++ b/roles/ntfy_client/tasks/main.yml @@ -0,0 +1,12 @@ +--- +- name: Get secrets + ansible.builtin.set_fact: + infrastructure_password: "{{ lookup('community.hashi_vault.hashi_vault', 'ansible/data/ntfy:infrastructure_password') }}" + +- name: Install curl wrapper + ansible.builtin.template: + src: curl-ntfy.j2 + dest: /usr/local/bin/curl-ntfy + owner: root + group: root + mode: 0755 diff --git a/roles/ntfy_client/templates/curl-ntfy.j2 b/roles/ntfy_client/templates/curl-ntfy.j2 new file mode 100644 index 0000000..dec9295 --- /dev/null +++ b/roles/ntfy_client/templates/curl-ntfy.j2 @@ -0,0 +1,5 @@ +#!/bin/bash + +PRIORITY=${3:-3} + +curl -X POST -u infrastructure:{{ infrastructure_password }} -H "X-Title: $1" -H "X-Priority: $PRIORITY" -d "$2" https://ntfy.xenrox.net/infrastructure -- 2.44.0