Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Retain order in yaml dictionaries #380

Merged
merged 1 commit into from Jan 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions tasks/configure.yml
Expand Up @@ -38,7 +38,7 @@

- name: configure Prometheus web
copy:
content: "{{ prometheus_web_config | to_nice_yaml(indent=2) }}"
content: "{{ prometheus_web_config | to_nice_yaml(indent=2,sort_keys=False) }}"
dest: "{{ prometheus_config_dir }}/web.yml"
force: true
owner: root
Expand All @@ -49,7 +49,7 @@
copy:
content: |
#jinja2: lstrip_blocks: True
{{ item.value | to_nice_yaml(indent=2) }}
{{ item.value | to_nice_yaml(indent=2,sort_keys=False) }}
dest: "{{ prometheus_config_dir }}/file_sd/{{ item.key }}.yml"
force: true
owner: root
Expand Down
2 changes: 1 addition & 1 deletion templates/alert.rules.j2
Expand Up @@ -3,4 +3,4 @@
groups:
- name: ansible managed alert rules
rules:
{{ prometheus_alert_rules | to_nice_yaml(indent=2) | indent(2,False) }}
{{ prometheus_alert_rules | to_nice_yaml(indent=2,sort_keys=False) | indent(2,False) }}
14 changes: 7 additions & 7 deletions templates/prometheus.yml.j2
Expand Up @@ -3,18 +3,18 @@
# http://prometheus.io/docs/operating/configuration/

global:
{{ prometheus_global | to_nice_yaml(indent=2) | indent(2, False) }}
{{ prometheus_global | to_nice_yaml(indent=2,sort_keys=False) | indent(2, False) }}
external_labels:
{{ prometheus_external_labels | to_nice_yaml(indent=2) | indent(4, False) }}
{{ prometheus_external_labels | to_nice_yaml(indent=2,sort_keys=False) | indent(4, False) }}

{% if prometheus_remote_write != [] %}
remote_write:
{{ prometheus_remote_write | to_nice_yaml(indent=2) | indent(2, False) }}
{{ prometheus_remote_write | to_nice_yaml(indent=2,sort_keys=False) | indent(2, False) }}
{% endif %}

{% if prometheus_remote_read != [] %}
remote_read:
{{ prometheus_remote_read | to_nice_yaml(indent=2) | indent(2, False) }}
{{ prometheus_remote_read | to_nice_yaml(indent=2,sort_keys=False) | indent(2, False) }}
{% endif %}

rule_files:
Expand All @@ -23,12 +23,12 @@ rule_files:
{% if prometheus_alertmanager_config | length > 0 %}
alerting:
alertmanagers:
{{ prometheus_alertmanager_config | to_nice_yaml(indent=2) | indent(2,False) }}
{{ prometheus_alertmanager_config | to_nice_yaml(indent=2,sort_keys=False) | indent(2,False) }}
{% if prometheus_alert_relabel_configs | length > 0 %}
alert_relabel_configs:
{{ prometheus_alert_relabel_configs | to_nice_yaml(indent=2) | indent(2,False) }}
{{ prometheus_alert_relabel_configs | to_nice_yaml(indent=2,sort_keys=False) | indent(2,False) }}
{% endif %}
{% endif %}

scrape_configs:
{{ prometheus_scrape_configs | to_nice_yaml(indent=2) | indent(2,False) }}
{{ prometheus_scrape_configs | to_nice_yaml(indent=2,sort_keys=False) | indent(2,False) }}