cloudalchemy / ansible-prometheus

Deploy Prometheus monitoring system
MIT License
1.11k stars 454 forks source link

Role fails on 'Fail when file_sd targets are not defined in scrape_configs' while using consul_sd #365

Closed YWatchman closed 1 year ago

YWatchman commented 3 years ago

What happened? Fails on assertion check for file_sd which is not in use for specific target.

Did you expect to see some different? It explicitly checks for file_sd, while I'm trying to implement consul_sd

How to reproduce it (as minimally and precisely as possible): Configure consul_sd

Environment Debian Buster

prometheus_scrape_configs:
   ...
    # Consul service discovery
    - job_name: node-exporter
      scrape_interval: 15s
      honor_labels: true
      consul_sd_configs:
        - services: [node-exporter]

prometheus_targets:
  node-exporter:
    - targets:
        "{{ groups['...'] | map('extract', hostvars, ['inventory_hostname']) | map('regex_replace', '$', ':9100') | list }}"
  alertmanager:
    - targets:
        "{{ groups['...'] | map('extract', hostvars, ['inventory_hostname']) | map('regex_replace', '$', ':9093') | list }}"
TASK [cloudalchemy.prometheus : Fail when file_sd targets are not defined in scrape_configs] ***************************************************************************************************
failed: [....] (item={'key': 'node-exporter', 'value': [{'targets': ['....:9100', '....:9100', '...:9100']}]}) => {"ansible_loop_var": "item", "changed": false, "item": {"key": "node-exporter", "value": [{"targets": ["....:9100", "...:9100", "...:9100"]}]}, "msg": "Oh, snap! `node-exporter` couldn't be found in your scrape configs. Please ensure you provided all targets from prometheus_targets in prometheus_scrape_configs\n"}
SuperQ commented 1 year ago

This role has been deprecated in favor of a the prometheus-community/ansible collection.