nfty
is an Ansible action plugin to post JSON messages to nfty and similar HTTP endpoints. The nfty server is open source.
Consider the following playbook which created the two notifications above:
- hosts: alice
vars:
topic: "admin-alerts"
tasks:
- name: "Notify ntfy that we're done (topic obtained from play var)"
ntfy:
msg: "deployment on {{ inventory_hostname }} is complete. 🐄 "
- name: "different topic"
ntfy:
msg: "that's a wrap"
topic: "admin-alerts"
attrs:
tags: [ rotating_light, heavy_check_mark ]
priority: 4
actions:
- action: view
label: "Open Mastodon"
url: "https://mastodon.social/@jpmens"