summaryrefslogtreecommitdiff
path: root/roles/monitoring/landingpage
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2022-12-07 22:36:08 +0100
committerChristian Pointner <equinox@spreadspace.org>2022-12-07 22:53:30 +0100
commit4d16bcd374f6fa830d1598a506d46b5b07aad857 (patch)
tree26186c96ccd677a37109daa75088e011047fe3bf /roles/monitoring/landingpage
parentmonitoring/grafana: fix permission fighting between ansible und grafana-server (diff)
monitoring: add simple landingpage
Diffstat (limited to 'roles/monitoring/landingpage')
-rw-r--r--roles/monitoring/landingpage/defaults/main.yml7
-rw-r--r--roles/monitoring/landingpage/tasks/main.yml29
-rw-r--r--roles/monitoring/landingpage/templates/index.html.j217
3 files changed, 53 insertions, 0 deletions
diff --git a/roles/monitoring/landingpage/defaults/main.yml b/roles/monitoring/landingpage/defaults/main.yml
new file mode 100644
index 00000000..ad2a3895
--- /dev/null
+++ b/roles/monitoring/landingpage/defaults/main.yml
@@ -0,0 +1,7 @@
+---
+# monitoring_landingpage_hostnames:
+# - "mon.example.com"
+
+monitoring_landingpage_acme: no
+
+#monitoring_landingpage_title: "Example Monitoring Host"
diff --git a/roles/monitoring/landingpage/tasks/main.yml b/roles/monitoring/landingpage/tasks/main.yml
new file mode 100644
index 00000000..3158770b
--- /dev/null
+++ b/roles/monitoring/landingpage/tasks/main.yml
@@ -0,0 +1,29 @@
+---
+- name: create nginx document root directory
+ file:
+ path: "/var/www/landingpage"
+ state: directory
+
+- name: copy index.html
+ template:
+ src: index.html.j2
+ dest: "/var/www/landingpage/index.html"
+
+- name: configure nginx vhost
+ vars:
+ nginx_vhost:
+ name: landingpage
+ template: generic
+ hostnames: "{{ monitoring_landingpage_hostnames }}"
+ acme: "{{ monitoring_landingpage_acme }}"
+ locations:
+ '/':
+ root: /var/www/landingpage
+ '/prometheus/':
+ proxy_pass: "http://{{ prometheus_server_web_listen_address | default('127.0.0.1:9090') }}"
+ '/alertmanager/':
+ proxy_pass: "http://{{ prometheus_alertmanager_web_listen_address | default('127.0.0.1:9093') }}"
+ '/grafana/':
+ proxy_pass: "http://{{ grafana_config_server.http_addr | default('localhost') }}:{{ grafana_config_server.http_port | default(3000) }}"
+ include_role:
+ name: nginx/vhost
diff --git a/roles/monitoring/landingpage/templates/index.html.j2 b/roles/monitoring/landingpage/templates/index.html.j2
new file mode 100644
index 00000000..8972b0d5
--- /dev/null
+++ b/roles/monitoring/landingpage/templates/index.html.j2
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>{{ monitoring_landingpage_title }} - {{ host_name }}.{{ host_domain }}</title>
+ <meta charset="utf-8">
+ </head>
+ <body style="padding-top: 5em; background-color: #eee; font-family: sans;">
+ <div style="text-align:center; margin-left:auto; margin-right:auto;">
+ <h1>{{ monitoring_landingpage_title }}</h1>
+ <ul>
+ <li><a target='_blank' href='/prometheus/'>Prometheus</a></li>
+ <li><a target='_blank' href='/alertmanager/'>Prometheus Alertmanager</a></li>
+ <li><a target='_blank' href='/grafana/'>Grafana</a></li>
+ </ul>
+ </div>
+ </body>
+</html>