diff --git a/ansible/roles/prometheus/tasks/config.yml b/ansible/roles/prometheus/tasks/config.yml index df8b030bec..0754d714dd 100644 --- a/ansible/roles/prometheus/tasks/config.yml +++ b/ansible/roles/prometheus/tasks/config.yml @@ -71,8 +71,8 @@ become: true vars: service: "{{ prometheus_services['prometheus-server'] }}" - common_overrides: "{{ prometheus_common_config_overrides_result.files | map(attribute='path') | list }}" - host_overrides: "{{ prometheus_host_config_overrides_result.files | map(attribute='path') | list }}" + common_overrides: "{{ prometheus_common_config_overrides_result.files | map(attribute='path') | list | sort }}" + host_overrides: "{{ prometheus_host_config_overrides_result.files | map(attribute='path') | list | sort }}" merge_yaml: sources: "{{ [item] + common_overrides + host_overrides }}" dest: "{{ node_config_directory }}/prometheus-server/prometheus.yml" diff --git a/releasenotes/notes/bug-2126635-794d6e351dc6fc2c.yaml b/releasenotes/notes/bug-2126635-794d6e351dc6fc2c.yaml new file mode 100644 index 0000000000..344266a214 --- /dev/null +++ b/releasenotes/notes/bug-2126635-794d6e351dc6fc2c.yaml @@ -0,0 +1,11 @@ +--- +fixes: + - | + Make generation of prometheus.yml consistent when using custom override + files. + + Previous behaviour would lead to changes in prometheus.yml on every run + when custom override files were used, as the find result was not sorted. + This could lead to unnecessary restarts and unreadable diffs of the + prometheus service. + `LP#2126635 `__