Files
ansible/proxmox/templates/telegram.env.j2
2025-08-02 21:02:36 +03:00

9 lines
371 B
Django/Jinja

#!/bin/bash
tg_token='{{ tgtoken }}'
chatid='{{ tgchatid }}'
function tgmsg {
clustername="$(pvesh get /cluster/status --output-format json | jq -r '.[] | select(.id == "cluster") | .name')"
curl -X POST -H 'Content-Type: application/json' -d '{"chat_id": "'"${chatid}"'", "text": "'"$HOSTNAME@$clustername: $1"'"}' https://api.telegram.org/bot$tg_token/sendMessage
}