Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

248 lines
14 KiB

  1. # SPDX-FileCopyrightText: 2024 - 2025 Slavi Pantaleev
  2. # SPDX-FileCopyrightText: 2024 - 2025 Suguru Hirahara
  3. #
  4. # SPDX-License-Identifier: AGPL-3.0-or-later
  5. ---
  6. # matrix-alertmanager-receiver is a service which receives webhook payloads from Prometheus' Alertmanager and forwards them to a Matrix room.
  7. # Project source code URL: https://github.com/metio/matrix-alertmanager-receiver
  8. matrix_alertmanager_receiver_enabled: true
  9. # renovate: datasource=docker depName=docker.io/metio/matrix-alertmanager-receiver
  10. matrix_alertmanager_receiver_version: 2025.9.3
  11. matrix_alertmanager_receiver_scheme: https
  12. # The hostname at which matrix-alertmanager-receiver is served.
  13. matrix_alertmanager_receiver_hostname: ''
  14. # The path at which matrix-alertmanager-receiver is served.
  15. # This value must either be `/` or not end with a slash (e.g. `/matrix-alertmanager-receiver`).
  16. matrix_alertmanager_receiver_path_prefix: /
  17. matrix_alertmanager_receiver_base_path: "{{ matrix_base_data_path }}/alertmanager-receiver"
  18. matrix_alertmanager_receiver_config_path: "{{ matrix_alertmanager_receiver_base_path }}/config"
  19. matrix_alertmanager_receiver_container_image_self_build: false
  20. matrix_alertmanager_receiver_container_image_self_build_repo: https://github.com/metio/matrix-alertmanager-receiver
  21. matrix_alertmanager_receiver_container_image_self_build_repo_version: "{{ 'main' if matrix_alertmanager_receiver_version == 'main' else matrix_alertmanager_receiver_version }}"
  22. matrix_alertmanager_receiver_container_src_path: "{{ matrix_alertmanager_receiver_base_path }}/container-src"
  23. matrix_alertmanager_receiver_container_image: "{{ matrix_alertmanager_receiver_container_image_registry_prefix }}metio/matrix-alertmanager-receiver:{{ matrix_alertmanager_receiver_container_image_tag }}"
  24. matrix_alertmanager_receiver_container_image_tag: "{{ matrix_alertmanager_receiver_version }}"
  25. matrix_alertmanager_receiver_container_image_force_pull: "{{ matrix_alertmanager_receiver_container_image.endswith(':main') }}"
  26. matrix_alertmanager_receiver_container_image_registry_prefix: "{{ matrix_alertmanager_receiver_container_image_registry_prefix_upstream }}"
  27. matrix_alertmanager_receiver_container_image_registry_prefix_upstream: "{{ matrix_alertmanager_receiver_container_image_registry_prefix_upstream_default }}"
  28. matrix_alertmanager_receiver_container_image_registry_prefix_upstream_default: "docker.io/"
  29. # The base container network. It will be auto-created by this role if it doesn't exist already.
  30. matrix_alertmanager_receiver_container_network: ''
  31. # A list of additional container networks that the container would be connected to.
  32. # The role does not create these networks, so make sure they already exist.
  33. matrix_alertmanager_receiver_container_additional_networks: "{{ matrix_alertmanager_receiver_container_additional_networks_default + matrix_alertmanager_receiver_container_additional_networks_auto + matrix_alertmanager_receiver_container_additional_networks_custom }}"
  34. matrix_alertmanager_receiver_container_additional_networks_default: []
  35. matrix_alertmanager_receiver_container_additional_networks_auto: []
  36. matrix_alertmanager_receiver_container_additional_networks_custom: []
  37. # Controls whether matrix-alertmanager-receiver metrics should be proxied (exposed) on `matrix.example.com/metrics/matrix-alertmanager-receiver`
  38. matrix_alertmanager_receiver_metrics_proxying_enabled: false
  39. matrix_alertmanager_receiver_metrics_proxying_hostname: ''
  40. matrix_alertmanager_receiver_metrics_proxying_path: /metrics/matrix-alertmanager-receiver
  41. # matrix_alertmanager_receiver_container_labels_traefik_enabled controls whether labels to assist a Traefik reverse-proxy will be attached to the container.
  42. # See `../templates/labels.j2` for details.
  43. #
  44. # To inject your own other container labels, see `matrix_alertmanager_receiver_container_labels_additional_labels`.
  45. matrix_alertmanager_receiver_container_labels_traefik_enabled: true
  46. matrix_alertmanager_receiver_container_labels_traefik_docker_network: "{{ matrix_alertmanager_receiver_container_network }}"
  47. matrix_alertmanager_receiver_container_labels_traefik_hostname: "{{ matrix_alertmanager_receiver_hostname }}"
  48. # The path prefix must either be `/` or not end with a slash (e.g. `/matrix-alertmanager-receiver`).
  49. matrix_alertmanager_receiver_container_labels_traefik_path_prefix: "{{ matrix_alertmanager_receiver_path_prefix }}"
  50. matrix_alertmanager_receiver_container_labels_traefik_rule: "Host(`{{ matrix_alertmanager_receiver_container_labels_traefik_hostname }}`){% if matrix_alertmanager_receiver_container_labels_traefik_path_prefix != '/' %} && PathPrefix(`{{ matrix_alertmanager_receiver_container_labels_traefik_path_prefix }}`){% endif %}"
  51. matrix_alertmanager_receiver_container_labels_traefik_priority: 0
  52. matrix_alertmanager_receiver_container_labels_traefik_entrypoints: web-secure
  53. matrix_alertmanager_receiver_container_labels_traefik_tls: "{{ matrix_alertmanager_receiver_container_labels_traefik_entrypoints != 'web' }}"
  54. matrix_alertmanager_receiver_container_labels_traefik_tls_certResolver: default # noqa var-naming
  55. # Controls whether labels will be added that expose metrics (see `matrix_alertmanager_receiver_metrics_proxying_enabled`) for matrix-alertmanager-receiver
  56. matrix_alertmanager_receiver_container_labels_public_metrics_enabled: "{{ matrix_alertmanager_receiver_metrics_enabled and matrix_alertmanager_receiver_metrics_proxying_enabled }}"
  57. matrix_alertmanager_receiver_container_labels_public_metrics_traefik_path: "{{ matrix_alertmanager_receiver_metrics_proxying_path }}"
  58. matrix_alertmanager_receiver_container_labels_public_metrics_traefik_rule: "Host(`{{ matrix_alertmanager_receiver_metrics_proxying_hostname }}`) && Path(`{{ matrix_alertmanager_receiver_container_labels_public_metrics_traefik_path }}`)"
  59. matrix_alertmanager_receiver_container_labels_public_metrics_traefik_priority: 0
  60. matrix_alertmanager_receiver_container_labels_public_metrics_traefik_entrypoints: "{{ matrix_alertmanager_receiver_container_labels_traefik_entrypoints }}"
  61. matrix_alertmanager_receiver_container_labels_public_metrics_traefik_tls: "{{ matrix_alertmanager_receiver_container_labels_public_metrics_traefik_entrypoints != 'web' }}"
  62. matrix_alertmanager_receiver_container_labels_public_metrics_traefik_tls_certResolver: "{{ matrix_alertmanager_receiver_container_labels_traefik_tls_certResolver }}" # noqa var-naming
  63. matrix_alertmanager_receiver_container_labels_public_metrics_middleware_basic_auth_enabled: false
  64. # See: https://doc.traefik.io/traefik/middlewares/http/basicauth/#users
  65. matrix_alertmanager_receiver_container_labels_public_metrics_middleware_basic_auth_users: ''
  66. # matrix_alertmanager_receiver_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file.
  67. # See `../templates/labels.j2` for details.
  68. #
  69. # Example:
  70. # matrix_alertmanager_receiver_container_labels_additional_labels: |
  71. # my.label=1
  72. # another.label="here"
  73. matrix_alertmanager_receiver_container_labels_additional_labels: ''
  74. # A list of extra arguments to pass to the container
  75. matrix_alertmanager_receiver_container_extra_arguments: []
  76. # Controls the `--log-level` argument passed to the container process.
  77. # Valid values: error, warn, info, debug
  78. matrix_alertmanager_receiver_container_process_argument_log_level: info
  79. # A list of extra arguments to pass to the container process.
  80. matrix_alertmanager_receiver_container_process_extra_arguments: []
  81. # List of systemd services that matrix-alertmanager-receiver-proxy.service depends on
  82. matrix_alertmanager_receiver_systemd_required_services_list: "{{ matrix_alertmanager_receiver_systemd_required_services_list_default + matrix_alertmanager_receiver_systemd_required_services_list_auto + matrix_alertmanager_receiver_systemd_required_services_list_custom }}"
  83. matrix_alertmanager_receiver_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}"
  84. matrix_alertmanager_receiver_systemd_required_services_list_auto: []
  85. matrix_alertmanager_receiver_systemd_required_services_list_custom: []
  86. # List of systemd services that matrix-alertmanager-receiver-proxy.service wants
  87. matrix_alertmanager_receiver_systemd_wanted_services_list: []
  88. # Controls the `http.port` configuration setting.
  89. matrix_alertmanager_receiver_config_http_port: 12345
  90. # Controls the `http.alerts-path-prefix` configuration setting.
  91. matrix_alertmanager_receiver_config_http_alerts_path_prefix: /alerts
  92. # Controls the `http.metrics-enabled` configuration setting.
  93. matrix_alertmanager_receiver_config_http_metrics_enabled: false
  94. # Controls the `http.metrics-path` configuration setting.
  95. matrix_alertmanager_receiver_config_http_metrics_path: /metrics
  96. # Controls the `matrix.homeserver-url` configuration setting.
  97. matrix_alertmanager_receiver_config_matrix_homeserver_url: ''
  98. # Controls the `matrix.user-id` configuration setting.
  99. matrix_alertmanager_receiver_config_matrix_user_id: "@{{ matrix_alertmanager_receiver_config_matrix_user_id_localpart }}:{{ matrix_domain }}"
  100. matrix_alertmanager_receiver_config_matrix_user_id_localpart: "bot.alertmanager.receiver"
  101. # Controls the `matrix.access-token` configuration setting.
  102. matrix_alertmanager_receiver_config_matrix_access_token: ''
  103. # Controls the `matrix.room-mapping` configuration setting.
  104. #
  105. # Example:
  106. # matrix_alertmanager_receiver_config_matrix_room:
  107. # simple-name: "!qporfwt:example.com"
  108. # another-name: "!aaabaa:example.com"
  109. matrix_alertmanager_receiver_config_matrix_room_mapping: {}
  110. # Controls the `templating.external-url-mapping` configuration setting.
  111. #
  112. # The key is the original value taken from the Alertmanager payload
  113. # The value is the mapped value which will be available as '.ExternalURL' in templates
  114. #
  115. # Example:
  116. # matrix_alertmanager_receiver_config_templating_external_url_mapping:
  117. # "http://alertmanager:9093": https://alertmanager.example.com
  118. # "http://alertmanager:9094": https://another.alertmanager.example.com
  119. matrix_alertmanager_receiver_config_templating_external_url_mapping: {}
  120. # Controls the `templating.generator-url-mapping` configuration setting.
  121. #
  122. # The key is the original value taken from the Alertmanager payload
  123. # The value is the mapped value which will be available as '.ExternalURL' in templates
  124. #
  125. # Example:
  126. # matrix_alertmanager_receiver_config_templating_generator_url_mapping:
  127. # "http://prometheus:8080": https://prometheus.example.com
  128. # "http://prometheus:8081": https://another.prometheus.example.com
  129. matrix_alertmanager_receiver_config_templating_generator_url_mapping: {}
  130. # Controls the `templating.computed-values` configuration setting.
  131. matrix_alertmanager_receiver_config_templating_computed_values: "{{ matrix_alertmanager_receiver_config_templating_computed_values_default + matrix_alertmanager_receiver_config_templating_computed_values_auto + matrix_alertmanager_receiver_config_templating_computed_values_custom }}"
  132. matrix_alertmanager_receiver_config_templating_computed_values_default:
  133. - values: # always set 'color' to 'yellow'
  134. color: yellow
  135. - values: # set 'color' to 'orange' when alert label 'severity' is 'warning'
  136. color: orange
  137. when-matching-labels:
  138. severity: warning
  139. - values: # set 'color' to 'red' when alert label 'severity' is 'critical'
  140. color: red
  141. when-matching-labels:
  142. severity: critical
  143. - values: # set 'color' to 'green' when alert status is 'resolved'
  144. color: green
  145. when-matching-status: resolved
  146. matrix_alertmanager_receiver_config_templating_computed_values_auto: []
  147. matrix_alertmanager_receiver_config_templating_computed_values_custom: []
  148. # Controls the `templating.firing-template` configuration setting.
  149. matrix_alertmanager_receiver_config_templating_firing_template: |-
  150. {% raw %}
  151. <p>
  152. <strong><font color="{{ .ComputedValues.color }}">{{ .Alert.Status | ToUpper }}</font></strong>
  153. {{ if .Alert.Labels.name }}
  154. {{ .Alert.Labels.name }}
  155. {{ else if .Alert.Labels.alertname }}
  156. {{ .Alert.Labels.alertname }}
  157. {{ end }}
  158. >>
  159. {{ if .Alert.Labels.severity }}
  160. {{ .Alert.Labels.severity | ToUpper }}:
  161. {{ end }}
  162. {{ if .Alert.Annotations.description }}
  163. {{ .Alert.Annotations.description }}
  164. {{ else if .Alert.Annotations.summary }}
  165. {{ .Alert.Annotations.summary }}
  166. {{ end }}
  167. >>
  168. {{ if .Alert.Annotations.runbook_url }}
  169. <a href="{{ .Alert.Annotations.runbook_url }}">Runbook</a> |
  170. {{ end }}
  171. {{ if .Alert.Annotations.dashboard }}
  172. <a href="{{ .Alert.Annotations.dashboard }}">Dashboard</a> |
  173. {{ end }}
  174. <a href="{{ .SilenceURL }}">Silence</a>
  175. </p>
  176. {% endraw %}
  177. # Controls the `templating.resolved-template` configuration setting.
  178. matrix_alertmanager_receiver_config_templating_resolved_template: |-
  179. {% raw %}
  180. <strong><font color="{{ .ComputedValues.color }}">{{ .Alert.Status | ToUpper }}</font></strong>
  181. {{ if .Alert.Labels.name }}
  182. {{ .Alert.Labels.name }}
  183. {{ else if .Alert.Labels.alertname }}
  184. {{ .Alert.Labels.alertname }}
  185. {{ end }}
  186. {% endraw %}
  187. # Default matrix-alertmanager-receiver configuration template which covers the generic use case.
  188. # You can customize it by controlling the various variables inside it.
  189. #
  190. # For a more advanced customization, you can extend the default (see `matrix_alertmanager_receiver_configuration_extension_yaml`)
  191. # or completely replace this variable with your own template.
  192. matrix_alertmanager_receiver_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}"
  193. matrix_alertmanager_receiver_configuration_extension_yaml: |
  194. # Your custom YAML configuration for matrix-alertmanager-receiver goes here.
  195. # This configuration extends the default starting configuration (`matrix_alertmanager_receiver_configuration_yaml`).
  196. #
  197. # You can override individual variables from the default configuration, or introduce new ones.
  198. #
  199. # If you need something more special, you can take full control by
  200. # completely redefining `matrix_alertmanager_receiver_configuration_yaml`.
  201. #
  202. # Example configuration extension follows:
  203. #
  204. # http:
  205. # address: ''
  206. matrix_alertmanager_receiver_configuration_extension: "{{ matrix_alertmanager_receiver_configuration_extension_yaml | from_yaml if matrix_alertmanager_receiver_configuration_extension_yaml | from_yaml is mapping else {} }}"
  207. # Holds the final matrix-alertmanager-receiver configuration (a combination of the default and its extension).
  208. # You most likely don't need to touch this variable. Instead, see `matrix_alertmanager_receiver_configuration_yaml`.
  209. matrix_alertmanager_receiver_configuration: "{{ matrix_alertmanager_receiver_configuration_yaml | from_yaml | combine(matrix_alertmanager_receiver_configuration_extension, recursive=True) }}"