summaryrefslogtreecommitdiffstats
path: root/roles/grafana/tasks
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-06-17 18:37:49 +0200
committerAhmed Abdelhalim <[email protected]>2026-06-17 18:42:02 +0200
commitc7a4dfce1ad0b545b05a8043e321ad49e48873a6 (patch)
treefe8a0bfc1bc31dc93a8138cce179df2416875bf4 /roles/grafana/tasks
parentd9dcfdd822f90eb65117523d7c15694fae952bd2 (diff)
Refactor pi roles to use .home.arpa subdomains for services
Diffstat (limited to 'roles/grafana/tasks')
-rw-r--r--roles/grafana/tasks/main.yml15
1 files changed, 15 insertions, 0 deletions
diff --git a/roles/grafana/tasks/main.yml b/roles/grafana/tasks/main.yml
index 3e29489b..f1fa479e 100644
--- a/roles/grafana/tasks/main.yml
+++ b/roles/grafana/tasks/main.yml
@@ -86,3 +86,18 @@
name: "{{ grafana_service }}"
state: "started"
enabled: true
+
+- name: "Create grafana nginx vhost configuration"
+ become: true
+ when: grafana_hostname | length > 0
+ ansible.builtin.template:
+ src: "grafana.nginx.conf.j2"
+ dest: "/etc/nginx/vhosts.d/grafana.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"