~xenrox/ansible

cbe9d68ff92484b4219c862067bd4cd3404134f0 — Thorben Günther 1 year, 6 months ago 5d8271f
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.
M playbooks/avalon.yml => playbooks/avalon.yml +1 -0
@@ 52,3 52,4 @@
    - { role: coturn }
    - { role: hedgedoc }
    - { role: ntfy_server }
    - { role: ntfy_client }

A roles/ntfy_client/tasks/main.yml => roles/ntfy_client/tasks/main.yml +12 -0
@@ 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

A roles/ntfy_client/templates/curl-ntfy.j2 => roles/ntfy_client/templates/curl-ntfy.j2 +5 -0
@@ 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