templates/agent-conf.d/pgbouncer.yaml.erb (21 lines of code) (raw):
<%
require 'yaml'
%>
<%- if @pgbouncers.empty? -%>
init_config:
instances:
- host: <%= @host %>
port: <%= @port %>
username: <%= @username %>
password: <%= @password %>
<% if @tags and ! @tags.empty? -%>
tags:
<%- Array(@tags).each do |tag| -%>
<%- if tag != '' -%>
- <%= tag %>
<%- end -%>
<%- end -%>
<% end -%>
<%- else -%>
<%= {'init_config'=>nil, 'instances'=>@pgbouncers}.to_yaml %>
<%- end -%>