From 7343a268a458cedfb0d44b511dfaf68e4c07f8d5 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Thu, 2 Nov 2017 09:15:07 +0100 Subject: [PATCH] Add support for custom telegraf configuration Change-Id: Iabf4f7da8a97793fae79bf6124b0da1feaf26d9a --- ansible/roles/telegraf/tasks/config.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ansible/roles/telegraf/tasks/config.yml b/ansible/roles/telegraf/tasks/config.yml index 0b415ca5b8..85676221ab 100644 --- a/ansible/roles/telegraf/tasks/config.yml +++ b/ansible/roles/telegraf/tasks/config.yml @@ -25,12 +25,16 @@ vars: service: "{{ telegraf_services['telegraf'] }}" template: - src: "telegraf.conf.j2" + src: "{{ item }}" dest: "{{ node_config_directory }}/telegraf/telegraf.conf" register: telegraf_confs when: - inventory_hostname in groups[service.group] - service.enabled | bool + with_first_found: + - "{{ node_custom_config }}/telegraf/{{ inventory_hostname }}/telegraf.conf" + - "{{ node_custom_config }}/telegraf/telegraf.conf" + - "telegraf.conf.j2" notify: - Restart telegraf container