Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The generated integration configs don't honor the order set in the playbook #548

Open
mazlumatabey opened this issue Feb 14, 2024 · 2 comments

Comments

@mazlumatabey
Copy link

image
Datadog rabbitmq node configuration will generate a wrong config.yaml file when we use node in datadog_checks variable.

Example:

datadog_checks:
  rabbitmq:
    init_config:
      service: rabbitmq_redis
    instances:
      - rabbitmq_api_url: http://localhost:15672/api/
        rabbitmq_user: My_user
        rabbitmq_pass: mypassword
        vhosts:
          - my_vhost
        nodes:
          - redis_cluster_node

Will generate this wrong config.yaml file:

 init_config:
  service: rabbitmq_redis
instances:
- nodes:
  - redis_cluster_node
  rabbitmq_api_url: http://localhost:15672/api/
  rabbitmq_pass: mypassword
  rabbitmq_user: My_user
  vhosts:
  - my_vhost

When we expect this config.yaml file:

init_config:
  service: rabbitmq_redis
instances:
- rabbitmq_api_url: http://localhost:15672/api/
  rabbitmq_pass: mypassword
  rabbitmq_user: My_user
  vhosts:
  - my_vhost
  nodes:
  - redis_cluster_node

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.

@bkabrda
Copy link
Contributor

bkabrda commented Feb 21, 2024

Hi 👋 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?

@alopezz
Copy link
Contributor

alopezz commented Jul 19, 2024

This looks related to #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.

@alopezz alopezz changed the title datadog_checks rabbitmq, cannot configure node. The generated integration configs don't honor the order set in the playbook Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants