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

telegraf_plugins_extra is override when multiple call #30

Closed
sinc59 opened this issue Jul 28, 2017 · 5 comments
Closed

telegraf_plugins_extra is override when multiple call #30

sinc59 opened this issue Jul 28, 2017 · 5 comments

Comments

@sinc59
Copy link

sinc59 commented Jul 28, 2017

Hello,
i use this role with multiple groups (postgres_database, rabbitmq)
For this, i use groups_vars files to specify extra_plugins (group_vars/postgres_database, group_vars/rabbitmq)
These files contains:

  • group_vars/postgres_database:
telegraf_plugins_extra:
    - plugin: postgresql
      config:
          - address = "postgres://user:password@localhost/postgres"
  • group_vars/rabbitmq
telegraf_plugins_extra:
    - plugin: rabbitmq
      config:
        - url = "http://localhost:15672"

If a server is one two roles (database and rabbitmq), the file /etc/telegraf/telegraf.d/extra-plugins.conf contain only the rabbitmq.

Do you know how i can aggregate this two have the postgresql and rabbitmq in this server ?

Best regards

@NikonNLG
Copy link

NikonNLG commented Oct 3, 2017

@sinc59 did you take a look at http://docs.ansible.com/ansible/latest/intro_configuration.html#hash-behaviour ?
you can try hash_behaviour = merge, but be care to not merge other settings.

@alekseyp
Copy link

alekseyp commented Apr 5, 2018

Same issue.

@bengoa
Copy link

bengoa commented May 3, 2018

I think you could use filename directive to generate different file names:

  • group_vars/postgres_database:
telegraf_plugins_extra:
    - plugin: postgresql
      filename: postgresql
      config:
          - address = "postgres://user:password@localhost/postgres"
  • group_vars/rabbitmq
telegraf_plugins_extra:
    - plugin: rabbitmq
      filename: rabbitmq
      config:
        - url = "http://localhost:15672"

@tjend
Copy link
Contributor

tjend commented May 6, 2018

This was solved in 0.9.0. See #46.

You will need to change your config to a hash instead of a list, and need hash_behaviour=merge in your ansible.cfg.

  • group_vars/postgres_database:
telegraf_plugins_extra:
  postgresql:
    config:
      - address = "postgres://user:password@localhost/postgres"
  • group_vars/rabbitmq
telegraf_plugins_extra:
  rabbitmq:
    config:
      - url = "http://localhost:15672"

@dj-wasabi
Copy link
Owner

Closing issue as fix is applied in a PR.

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

6 participants