added support for telegram notifications

This commit is contained in:
nd 2020-06-04 01:25:44 +02:00
parent 0f748dd02a
commit 069df8c553
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
5 changed files with 107 additions and 2 deletions

View file

@ -16,3 +16,33 @@
mode: 0644
dest: /etc/prometheus/alertmanager.yml
content: "{{ prometheus_alertmanager.config|to_nice_yaml(indent=2) }}"
- name: setup telegram bot
when: prometheus_alertmanager.telegrambot
block:
- name: install dependencies
apt:
pkg:
- python3-flask
- python3-dateutil
- python3-gevent
- python3-pip
# - python3-telegram-bot
- pip:
name: python-telegram-bot
executable: pip3
- name: deploy telegram bot
notify: restart telegram bot
template:
src: telegram-bot.py.j2
dest: /usr/local/bin/prometheus-telegram-bot.py
mode: 0755
owner: root
group: root
- name: Copy systemd service file
notify: restart telegram bot
copy:
src: prometheus-telegram-bot.service
dest: /etc/systemd/system
owner: root
group: root