{%- from "elasticsearch/map.jinja" import server with context %} {%- if server.get('enabled', False) %} {%- set address = server.get('bind', {}).get('address', '127.0.0.1') %} {%- set port = server.get('bind', {}).get('port', 9200) %} {%- set servers = ['http://{}:{}'.format(address, port)] %} agent: input: elasticsearch: servers: {{ servers|yaml }} local: true cluster_health: true cluster_stats: true {%- endif %}