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: 2026.2.11
  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.firing-template` configuration setting.
  131. matrix_alertmanager_receiver_config_templating_firing_template: |-
  132. {% raw %}
  133. {{ $color := "yellow" }}
  134. {{ if eq .Alert.Labels.severity "warning" }}
  135. {{ $color = "orange" }}
  136. {{ else if eq .Alert.Labels.severity "critical" }}
  137. {{ $color = "red" }}
  138. {{ end }}
  139. {{ if eq .Alert.Status "resolved" }}
  140. {{ $color = "green" }}
  141. {{ end }}
  142. <p>
  143. <strong><font color="{{ $color }}">{{ .Alert.Status | ToUpper }}</font></strong>
  144. {{ if .Alert.Labels.name }}
  145. {{ .Alert.Labels.name }}
  146. {{ else if .Alert.Labels.alertname }}
  147. {{ .Alert.Labels.alertname }}
  148. {{ end }}
  149. >>
  150. {{ if .Alert.Labels.severity }}
  151. {{ .Alert.Labels.severity | ToUpper }}:
  152. {{ end }}
  153. {{ if .Alert.Annotations.description }}
  154. {{ .Alert.Annotations.description }}
  155. {{ else if .Alert.Annotations.summary }}
  156. {{ .Alert.Annotations.summary }}
  157. {{ end }}
  158. >>
  159. {{ if .Alert.Annotations.runbook_url }}
  160. <a href="{{ .Alert.Annotations.runbook_url }}">Runbook</a> |
  161. {{ end }}
  162. {{ if .Alert.Annotations.dashboard }}
  163. <a href="{{ .Alert.Annotations.dashboard }}">Dashboard</a> |
  164. {{ end }}
  165. <a href="{{ .SilenceURL }}">Silence</a>
  166. </p>
  167. {% endraw %}
  168. # Controls the `templating.resolved-template` configuration setting.
  169. matrix_alertmanager_receiver_config_templating_resolved_template: |-
  170. {% raw %}
  171. <strong><font color="green">{{ .Alert.Status | ToUpper }}</font></strong>
  172. {{ if .Alert.Labels.name }}
  173. {{ .Alert.Labels.name }}
  174. {{ else if .Alert.Labels.alertname }}
  175. {{ .Alert.Labels.alertname }}
  176. {{ end }}
  177. {% endraw %}
  178. # Default matrix-alertmanager-receiver configuration template which covers the generic use case.
  179. # You can customize it by controlling the various variables inside it.
  180. #
  181. # For a more advanced customization, you can extend the default (see `matrix_alertmanager_receiver_configuration_extension_yaml`)
  182. # or completely replace this variable with your own template.
  183. matrix_alertmanager_receiver_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}"
  184. matrix_alertmanager_receiver_configuration_extension_yaml: |
  185. # Your custom YAML configuration for matrix-alertmanager-receiver goes here.
  186. # This configuration extends the default starting configuration (`matrix_alertmanager_receiver_configuration_yaml`).
  187. #
  188. # You can override individual variables from the default configuration, or introduce new ones.
  189. #
  190. # If you need something more special, you can take full control by
  191. # completely redefining `matrix_alertmanager_receiver_configuration_yaml`.
  192. #
  193. # Example configuration extension follows:
  194. #
  195. # http:
  196. # address: ''
  197. 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 {} }}"
  198. # Holds the final matrix-alertmanager-receiver configuration (a combination of the default and its extension).
  199. # You most likely don't need to touch this variable. Instead, see `matrix_alertmanager_receiver_configuration_yaml`.
  200. matrix_alertmanager_receiver_configuration: "{{ matrix_alertmanager_receiver_configuration_yaml | from_yaml | combine(matrix_alertmanager_receiver_configuration_extension, recursive=True) }}"
  201. # matrix_alertmanager_receiver_restart_necessary controls whether the service
  202. # will be restarted (when true) or merely started (when false) by the
  203. # systemd service manager role (when conditional restart is enabled).
  204. #
  205. # This value is automatically computed during installation based on whether
  206. # any configuration files, the systemd service file, or the container image changed.
  207. # The default of `false` means "no restart needed" — appropriate when the role's
  208. # installation tasks haven't run (e.g., due to --tags skipping them).
  209. matrix_alertmanager_receiver_restart_necessary: false