cloudalchemy / ansible-prometheus

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

prometheus_scrape_configs changes line order #310

Closed webchi closed 4 years ago

webchi commented 4 years ago

Looks like to_nice_yaml shuffle lines What happened?

scrape_configs:
  - dockerswarm_sd_configs:
    - host: unix:///var/run/docker.sock
      role: nodes
    job_name: docker
  - job_name: prometheus
    static_configs:
    - targets:
      - 10.0.10.7:9090

Did you expect to see some different?

scrape_configs:
  - job_name: docker
    dockerswarm_sd_configs:
    - host: unix:///var/run/docker.sock
      role: nodes

  - job_name: prometheus
    static_configs:
    - targets:
      - 10.0.10.7:9090

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

  vars:
    prometheus_scrape_configs:
      - job_name: docker
        dockerswarm_sd_configs:
          - host: unix:///var/run/docker.sock
            role: nodes
      - job_name: prometheus
        static_configs:
          - targets:
              - "{{ ansible_default_ipv4.address }}:9090"

Environment

2.15.5

ansible 2.9.13

SuperQ commented 4 years ago

Does it change the ordering randomly every time? Or is just not in the order you're expecting?

webchi commented 4 years ago

@SuperQ such order is not expected by me and prometheus, because -job name should be on first place. But filter order that yaml alphabeticaly.

SuperQ commented 4 years ago

Prometheus does not care about key order.