Limit scrape_config_files to supported versions

Signed-off-by: Leonhard Mayr <leonhard.mayr@manz.at>
This commit is contained in:
Leonhard Mayr 2024-05-29 12:14:24 +02:00
parent 60fe2d4332
commit 62f1a07b6f
No known key found for this signature in database
2 changed files with 3 additions and 0 deletions

View file

@ -153,6 +153,7 @@ argument_specs:
prometheus_scrape_config_files:
description:
- "List of folders where ansible will look for files containing custom scrape config configuration files which will be copied to C({{ prometheus_config_dir }}/scrapes/)."
- "This feature is available starting from Prometheus v2.43.0."
type: "list"
elements: "str"
default:

View file

@ -35,7 +35,9 @@ alerting:
scrape_configs:
{{ prometheus_scrape_configs | to_nice_yaml(indent=2,sort_keys=False) | indent(2,False) }}
{% if prometheus_version is version('2.43.0', '>=') %}
{% if prometheus_scrape_config_files != [] %}
scrape_config_files:
- scrapes/*
{% endif %}
{% endif %}