-service "promscale" do
- action [:enable, :start]
- subscribes :restart, "remote_file[/opt/promscale/bin/promscale]"
- subscribes :restart, "systemd_service[promscale]"
-end
-
-postgresql_extension "promscale" do
- cluster database_cluster
- database "promscale"
- notifies :restart, "service[promscale]"
-end
-
-systemd_service "promscale-maintenance" do
- description "Promscale Maintenace"
- type "simple"
- user "prometheus"
- exec_start "/usr/bin/psql --command='CALL prom_api.execute_maintenance()' promscale"
- private_tmp true
- protect_system "strict"
- protect_home true
- no_new_privileges true
-end
-
-systemd_timer "promscale-maintenance" do
- description "Promscale Maintenace"
- on_active_sec 1800
- on_unit_inactive_sec 1800
-end
-
-service "promscale-maintenance.timer" do
- action [:enable, :start]
+if node[:prometheus][:promscale]
+ service "promscale" do
+ action [:enable, :start]
+ subscribes :restart, "remote_file[/opt/promscale/bin/promscale]"
+ subscribes :restart, "systemd_service[promscale]"
+ end
+else
+ service "promscale" do
+ action [:disable, :stop]
+ end