From c7a4dfce1ad0b545b05a8043e321ad49e48873a6 Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Wed, 17 Jun 2026 18:37:49 +0200 Subject: Refactor pi roles to use .home.arpa subdomains for services --- roles/prometheus/tasks/main.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'roles/prometheus/tasks') diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml index 1f639c6d..8e315bec 100644 --- a/roles/prometheus/tasks/main.yml +++ b/roles/prometheus/tasks/main.yml @@ -61,3 +61,18 @@ name: "prometheus" state: "started" enabled: true + +- name: "Create prometheus nginx vhost configuration" + become: true + when: prometheus_hostname | length > 0 + ansible.builtin.template: + src: "prometheus.nginx.conf.j2" + dest: "/etc/nginx/vhosts.d/prometheus.conf" + owner: "root" + group: "root" + mode: "0644" + backup: true + validate: > + bash -c 'echo "events { worker_connections 64; } http { include %s; }" > /tmp/nginx-vhost.conf; + sudo nginx -T -c /tmp/nginx-vhost.conf; ec=$?; rm -f /tmp/nginx-vhost.conf; exit $ec' + notify: "Restart nginx" -- cgit v1.2.3