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.
 
 

246 lines
14 KiB

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