]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/prometheus/recipes/server.rb
Enable promscale maintenance timer
[chef.git] / cookbooks / prometheus / recipes / server.rb
index 7e4f4b2bf9ee83a05c866901bad9f07df45cbf3a..d349495ab74dd1ebd1587f06ae1da0779ec3449b 100644 (file)
@@ -144,8 +144,24 @@ systemd_timer "promscale-maintenance" do
   on_unit_inactive_sec 1800
 end
 
+service "promscale-maintenance.timer" do
+  action [:enable, :start]
+end
+
 jobs = {}
 
+search(:node, "roles:gateway") do |gateway|
+  allowed_ips = gateway.interfaces(:role => :internal).map do |interface|
+    "#{interface[:network]}/#{interface[:prefix]}"
+  end
+
+  node.default[:networking][:wireguard][:peers] << {
+    :public_key => gateway[:networking][:wireguard][:public_key],
+    :allowed_ips => allowed_ips,
+    :endpoint => "#{gateway.name}:51820"
+  }
+end
+
 search(:node, "recipes:prometheus\\:\\:default").sort_by(&:name).each do |client|
   if client[:prometheus][:mode] == "wireguard"
     node.default[:networking][:wireguard][:peers] << {