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

Conversation

sdarwin
Copy link
Contributor

@sdarwin sdarwin commented Jan 4, 2022

In group_vars, the scrape_configs are nicely formatted with job_name at the top. That is clear and readable.

Then, you run ansible and it generates the prometheus.yml file. The resulting scrape configs are jumbled. They lose the previous ordering.

The solution is adding sort_keys=False to the to_nice_yaml filter.

References:
yaml/pyyaml#110
ansible/ansible#76638

@github-actions github-actions bot added area/jinja Templates area/tasks Logic behind ansible role labels Jan 4, 2022
@SuperQ SuperQ self-requested a review January 23, 2022 18:55
Copy link
Collaborator

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SuperQ SuperQ merged commit 1440ae7 into cloudalchemy:master Jan 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/jinja Templates area/tasks Logic behind ansible role
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants