alertmanager.yml.j2 34 lignes · 1017 octets
# {{ ansible_managed }}
{% set destinataires = oiam_supervision.alertes_emails | default([]) %}
{% if oiam_smtp and destinataires | length > 0 %}
global:
  smtp_smarthost: "{{ oiam_smtp.hote }}:{{ oiam_smtp.port }}"
  smtp_from: "{{ oiam_smtp.expediteur }}"
  smtp_hello: "{{ inventory_hostname }}"
  smtp_require_tls: {{ 'true' if oiam_smtp.chiffrement == 'starttls' else 'false' }}
{% if oiam_smtp.utilisateur | default('') %}
  smtp_auth_username: "{{ oiam_smtp.utilisateur }}"
  smtp_auth_password: "{{ oiam_smtp_mot_de_passe | default('') }}"
{% endif %}
{% endif %}

route:
  receiver: open-iam
  group_by: [alertname]
  group_wait: 30s
  group_interval: 5m
  repeat_interval: 12h

receivers:
  - name: open-iam
{% if oiam_smtp and destinataires | length > 0 %}
    email_configs:
{% for email in destinataires %}
      - to: "{{ email }}"
        send_resolved: true
{% if oiam_smtp.chiffrement == 'tls' %}
        tls_config:
          server_name: "{{ oiam_smtp.hote }}"
{% endif %}
{% endfor %}
{% endif %}