diff --git a/ansible/roles/telegraf/templates/telegraf.conf.j2 b/ansible/roles/telegraf/templates/telegraf.conf.j2
index 52e67f0ff4b59694e47859323b6640e4fb661752..5f6fd9ae6a4b5fbc546da5460111e3c7d2b83704 100644
--- a/ansible/roles/telegraf/templates/telegraf.conf.j2
+++ b/ansible/roles/telegraf/templates/telegraf.conf.j2
@@ -12,12 +12,14 @@
   hostname = ""
   omit_hostname = false
 {% if enable_influxdb | bool %}
+{% for host in groups['influxdb'] %}
 [[outputs.influxdb]]
-  urls = [{% for host in groups['influxdb'] %}"{{ influxdb_proto }}://{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address']}}:{{ influxdb_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
+  urls = ["{{ influxdb_proto }}://{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address']}}:{{ influxdb_http_port }}"]
   database = "telegraf" # required
   retention_policy = "autogen"
   write_consistency = "any"
   timeout = "5s"
+{% endfor %}
 {% endif %}
 [[inputs.cpu]]
   percpu = true