dj-wasabi / ansible-telegraf

Installing and configuring Telegraf via Ansible for RedHat/Debian/Ubuntu/Windows/Suse.
MIT License
134 stars 116 forks source link

telegraf_plugins_extra is override when multiple call #30

Closed sinc59 closed 6 years ago

sinc59 commented 7 years ago

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:

telegraf_plugins_extra:
    - plugin: postgresql
      config:
          - address = "postgres://user:password@localhost/postgres"

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 commented 7 years ago

@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 commented 6 years ago

Same issue.

bengoa commented 6 years ago

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

tjend commented 6 years ago

This was solved in 0.9.0. See https://github.com/dj-wasabi/ansible-telegraf/pull/46.

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

telegraf_plugins_extra:
  postgresql:
    config:
      - address = "postgres://user:password@localhost/postgres"
dj-wasabi commented 6 years ago

Closing issue as fix is applied in a PR.