1
0
Fork 0
mirror of https://gitlab.com/s3lph/ansible-collection-prometheus synced 2024-10-23 11:56:59 +02:00
ansible-collection-prometheus/roles/alertmanager/templates/alertmanager.yml.j2

94 lines
3.1 KiB
Text
Raw Permalink Normal View History

2020-11-13 10:36:46 +01:00
---
{{ ansible_managed | comment }}
global:
{% if 'smtp' in notification_channels %}
# The default SMTP From header field.
smtp_from: {{ notification_channels.smtp.from }}
# The default SMTP smarthost used for sending emails, including port number.
# Port number usually is 25, or 587 for SMTP over TLS (sometimes referred to as STARTTLS).
# Example: smtp.example.org:587
smtp_smarthost: {{ notification_channels.smtp.host }}
# The default hostname to identify to the SMTP server.
smtp_hello: {{ notification_channels.smtp.hello | default(notfication_channel_smtp_hello) }}
# SMTP Auth using CRAM-MD5, LOGIN and PLAIN. If empty, Alertmanager doesn't authenticate to the SMTP server.
smtp_auth_username: {{ notification_channels.smtp.username | default(notification_channels.smtp.from) }}
{% if notification_channels.smtp.method == 'login' %}
# SMTP Auth using LOGIN and PLAIN.
smtp_auth_password: {{ notification_channels.smtp.password }}
{% elif notification_channels.smtp.method == 'plain' %}
# SMTP Auth using PLAIN.
smtp_auth_identity: {{ notification_channels.smtp.password }}
{% elif notification_channels.smtp.method == 'cram-md5' %}
# SMTP Auth using CRAM-MD5.
smtp_auth_secret: {{ notification_channels.smtp.password }}
{% endif %}
# The default SMTP TLS requirement.
smtp_require_tls: {{ (not notification_channels.smtp.tls_not_required) | default(True) }}
{% endif %}
{% if 'slack' in notification_channels %}
# The API URL to use for Slack notifications.
slack_api_url: {{ notification_channels.slack.url }}
{% endif %}
{% if 'victorops' in notification_channels %}
victorops_api_url: {{ notification_channels.victorops.url }}
victorops_api_key: {{ notification_channels.victorops.key }}
{% endif %}
{% if 'pagerduty' in notification_channels %}
pagerduty_url: {{ notification_channels.pagerduty.url }}
{% endif %}
{% if 'opsgenie' in notification_channels %}
opsgenie_api_url: {{ notification_channels.opsgenie.url }}
opsgenie_api_key: {{ notification_channels.opsgenie.key }}
{% endif %}
{% if 'hipchat' in notification_channels %}
hipchat_api_url: {{ notification_channels.hipchat.url }}
hipchat_auth_token: {{ notification_channels.hipchat.key }}
{% endif %}
{% if 'wechat' in notification_channels %}
wechat_api_url: {{ notification_channels.wechat.url }}
wechat_api_secret: {{ notification_channels.wechat.key }}
wechat_api_corp_id: {{ notification_channels.wechat.corp }}
{% endif %}
{% if 'http' in notification_channels %}
http_config: {}
{% endif %}
templates:
{% if notification_templates | length == 0 %}
[]
{% else %}
{% for template in notification_templates %}
- {{ template.path }}
{% endfor %}
{% endif %}
receivers:
{% if notification_receivers | length == 0 %}
[]
{% else %}
{% for name, config in notification_receivers.items() %}
- name: {{ name }}
{{ config | to_nice_yaml(indent=2) | indent(width=4) }}
{% endfor %}
{% endif %}
inhibit_rules:
{% if inhibit_rules | length == 0 %}
[]
{% else %}
{% for rule in inhibit_rules %}
- {{ rule | to_nice_yaml(indent=2) | indent(width=4) }}
{% endfor %}
{% endif %}
route:
{{ routes | to_nice_yaml(indent=2) | indent(width=2) }}