Move web port to an attribute

This commit is contained in:
Greg Karekinian
2026-07-05 18:16:18 +02:00
parent 8601e33764
commit 5e7a0c07b0
2 changed files with 7 additions and 3 deletions
@@ -10,6 +10,8 @@ checksum = node["kosmos_prometheus"]["checksum"]
tarball = "#{Chef::Config[:file_cache_path]}/prometheus-#{version}.linux-amd64.tar.gz"
binary_url = "https://github.com/prometheus/prometheus/releases/download/v#{version}/prometheus-#{version}.linux-amd64.tar.gz"
web_port = node["kosmos_prometheus"]["web"]["port"]
group "prometheus"
user "prometheus" do
@@ -110,7 +112,7 @@ systemd_unit "prometheus.service" do
Type: "simple",
User: "prometheus",
Group: "prometheus",
ExecStart: "/usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus --storage.tsdb.retention.time=15d --web.listen-address=:9090 --web.enable-lifecycle",
ExecStart: "/usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus --storage.tsdb.retention.time=15d --web.listen-address=:#{web_port} --web.enable-lifecycle",
ExecReload: "/bin/kill -HUP $MAINPID",
Restart: "on-failure",
RestartSec: "5",
@@ -128,7 +130,7 @@ service "prometheus" do
end
firewall_rule "prometheus web" do
port 9090
port web_port
source "10.1.1.0/24"
protocol :tcp
command :allow