From: Tom Hughes Date: Wed, 16 Sep 2020 16:54:38 +0000 (+0100) Subject: Add brackets around IPv6 addresses X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/1cac4eb8d40ccb2d534f030c3329a456e03404bd Add brackets around IPv6 addresses --- diff --git a/cookbooks/prometheus/resources/exporter.rb b/cookbooks/prometheus/resources/exporter.rb index c75248f99..08c0e03b7 100644 --- a/cookbooks/prometheus/resources/exporter.rb +++ b/cookbooks/prometheus/resources/exporter.rb @@ -77,7 +77,11 @@ action_class do end def listen_address - "#{node[:prometheus][:address]}:#{new_resource.port}" + if node[:prometheus][:mode] == "wireguard" + "[#{node[:prometheus][:address]}]:#{new_resource.port}" + else + "#{node[:prometheus][:address]}:#{new_resource.port}" + end end def service_name diff --git a/cookbooks/prometheus/templates/default/prometheus.yml.erb b/cookbooks/prometheus/templates/default/prometheus.yml.erb index 66051b622..46d241905 100644 --- a/cookbooks/prometheus/templates/default/prometheus.yml.erb +++ b/cookbooks/prometheus/templates/default/prometheus.yml.erb @@ -16,7 +16,7 @@ scrape_configs: static_configs: <% targets.each do |target| -%> - targets: - - <%= target[:address] %> + - "<%= target[:address] %>" labels: instance: <%= target[:name].split(".").first %> <% end -%>