slashpai.ansible_prometheus_msteams
Ansible Role Prometheus-MSTeams
What is ansible-prometheus-msteams?
This Ansible role helps you install and set up prometheus-msteams to send alerts from alertmanager to Microsoft Teams.
Overview
I created this role because I found that there’s no straightforward way to use Microsoft Teams as a recipient in the alertmanager configuration. Since there was no existing Ansible role for this purpose, I built this one. It is inspired by ansible-node-exporter.
Requirements
- Ansible version 2.9 or higher (This may work on earlier versions, but I haven’t tested them.)
Role Variables
You can change the default values of the variables listed in default/main.yml:
Name | Default Value | Description |
---|---|---|
prometheus_msteams_version |
latest | Version of prometheus-msteams to install |
prometheus_msteams_binary_local_dir |
"" | Use local packages from the controller instead of GitHub packages |
prometheus_msteams_template_local_dir |
"" | Use local Teams card template instead of GitHub template |
prometheus_msteams_config_dir |
"/etc/prometheus_msteams" | Directory for server configuration |
prometheus_msteams_web_listen_address |
"0.0.0.0:2000" | Address for prometheus-msteams to listen on |
prometheus_msteams_request_uri |
"alertmanager" | Request URI for Teams |
prometheus_msteams_channels |
[] | Channels to send alerts from alert manager |
Dependencies
None
How to Use
From Galaxy
To install the role from Ansible Galaxy, run:
ansible-galaxy install slashpai.ansible_prometheus_msteams
Using Git Submodule
If you prefer to add the role as a submodule in your project, use:
git submodule add -b main https://github.com/slashpai/ansible-prometheus-msteams.git roles/prometheus-msteams
To update the role:
git submodule update --remote
Example Playbook
Here’s an example of how to use this role in a playbook:
- hosts: all
roles:
- slashpai.ansible_prometheus_msteams
You can also check out an example playbook that uses a Git submodule.
Contributing
If you'd like to contribute:
- Fork the project on GitHub
- Clone your fork
- Make your changes (and add tests)
- Commit and push your changes
- Create a pull request
TODO
- Add tests for Ubuntu and determine the correct Inspec version to use due to licensing differences.
License
This project is licensed under the MIT License.
To install and configure prometheus-msteams for sending notifications from alertmanager to microsoft teams
ansible-galaxy install slashpai.ansible_prometheus_msteams