Open mazlumatabey opened 6 months ago
Hi :wave: thanks for opening this issue report.
I have to say I'm not exactly sure where the problem is. Yes, Ansible indeed reorganizes the keys, but the resulting yaml still represents the same structure. You can try parsing the resulting yaml and the yaml you expected by any yaml parser and you'll get the same results (at least I did, I might have missed something). Can you explain exactly what problem you're seeing with the config that you get?
This looks related to https://github.com/DataDog/ansible-datadog/pull/557. It's still unclear how the reordering "breaks" anything but it looks like it does confuse some people; I'll create a backlog card to look at this.
EDIT: I'll also rename this issue to better represent the issue at hand.
Example:
Will generate this wrong config.yaml file:
When we expect this config.yaml file:
When using the "nodes" key, Ansible treats it as a re-organization of the elements in the data structure. Instead of simply renaming the key, Ansible considers it a new key with an associated value, and it re-arranges the other keys around this new key in the YAML output.
PS: check about map('combine') in ansible.