diff options
| author | Ahmed Abdelhalim <[email protected]> | 2026-06-18 16:30:12 +0200 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2026-06-18 16:32:15 +0200 |
| commit | 6a0fd11c6bd782a42b0b90d2f2365859a7953bb7 (patch) | |
| tree | bf50fdd6ee47a5fde5bd3a05b96006138100dee8 /roles/grafana/tasks | |
| parent | c7a4dfce1ad0b545b05a8043e321ad49e48873a6 (diff) | |
Implement support for conditional proxy (nginx or caddy)
Diffstat (limited to 'roles/grafana/tasks')
| -rw-r--r-- | roles/grafana/tasks/main.yml | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/roles/grafana/tasks/main.yml b/roles/grafana/tasks/main.yml index f1fa479e..f7b7d851 100644 --- a/roles/grafana/tasks/main.yml +++ b/roles/grafana/tasks/main.yml @@ -89,7 +89,7 @@ - name: "Create grafana nginx vhost configuration" become: true - when: grafana_hostname | length > 0 + when: proxy_type == "nginx" and grafana_hostname | length > 0 ansible.builtin.template: src: "grafana.nginx.conf.j2" dest: "/etc/nginx/vhosts.d/grafana.conf" @@ -100,4 +100,15 @@ 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" + notify: "Restart proxy" + +- name: "Create grafana caddy configuration" + become: true + when: proxy_type == "caddy" and grafana_hostname | length > 0 + ansible.builtin.template: + src: "grafana.caddy.j2" + dest: "/etc/caddy/sites/grafana.caddy" + owner: "root" + group: "caddy" + mode: "0640" + notify: "Restart proxy" |
