Move the alertmanager port to an attribute

This commit is contained in:
2026-07-09 15:23:46 +02:00
parent ae14a1f353
commit f15d5cb958
2 changed files with 7 additions and 3 deletions
@@ -10,6 +10,8 @@ checksum = node["kosmos_prometheus"]["alertmanager"]["checksum"]
tarball = "#{Chef::Config[:file_cache_path]}/alertmanager-#{version}.linux-amd64.tar.gz"
binary_url = "https://github.com/prometheus/alertmanager/releases/download/v#{version}/alertmanager-#{version}.linux-amd64.tar.gz"
alertmanager_port = node["kosmos_prometheus"]["alertmanager"]["port"]
group "alertmanager"
user "alertmanager" do
@@ -81,7 +83,7 @@ systemd_unit "alertmanager.service" do
Type: "simple",
User: "alertmanager",
Group: "alertmanager",
ExecStart: "/usr/local/bin/alertmanager --config.file=/etc/prometheus/alertmanager.yml --storage.path=/var/lib/alertmanager --web.listen-address=:9093",
ExecStart: "/usr/local/bin/alertmanager --config.file=/etc/prometheus/alertmanager.yml --storage.path=/var/lib/alertmanager --web.listen-address=:#{alertmanager_port}",
Restart: "on-failure",
RestartSec: "5",
},
@@ -98,7 +100,7 @@ service "alertmanager" do
end
firewall_rule "prometheus alertmanager" do
port 9093
port alertmanager_port
source "10.1.1.0/24"
protocol :tcp
command :allow