summaryrefslogtreecommitdiffstats
path: root/ansible
diff options
context:
space:
mode:
Diffstat (limited to 'ansible')
-rw-r--r--ansible/roles/kube-prometheus-stack/defaults/main.yml5
-rw-r--r--ansible/roles/kube-prometheus-stack/files/grafana_home.json126
-rw-r--r--ansible/roles/kube-prometheus-stack/tasks/main.yml7
3 files changed, 135 insertions, 3 deletions
diff --git a/ansible/roles/kube-prometheus-stack/defaults/main.yml b/ansible/roles/kube-prometheus-stack/defaults/main.yml
index 53685bec..8803b802 100644
--- a/ansible/roles/kube-prometheus-stack/defaults/main.yml
+++ b/ansible/roles/kube-prometheus-stack/defaults/main.yml
@@ -1,12 +1,17 @@
---
kube_prometheus_stack:
k8s_namespace: kube-prometheus
+ grafana_dashboards:
+ - { src: "grafana_dashboard.json", dest: "{{ nfs_mount_path }}/kube-prometheus/kube-prometheus-grafana/dashboards/custom/" }
+ - { src: "grafana_home.json", dest: "{{ nfs_mount_path }}/kube-prometheus/kube-prometheus-grafana/dashboards/" }
helm_release_name: kube-prometheus-stack
helm_timeout: "240s"
helm_values_file: "{{ app_data_path }}/kube_prometheus_values.yaml"
helm_values:
grafana:
adminPassword: grafana
+ env:
+ GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH: /var/lib/grafana/dashboards/grafana_home.json
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
diff --git a/ansible/roles/kube-prometheus-stack/files/grafana_home.json b/ansible/roles/kube-prometheus-stack/files/grafana_home.json
new file mode 100644
index 00000000..bfce2930
--- /dev/null
+++ b/ansible/roles/kube-prometheus-stack/files/grafana_home.json
@@ -0,0 +1,126 @@
+{
+ "annotations": {
+ "list": [
+ {
+ "builtIn": 1,
+ "datasource": "-- Grafana --",
+ "enable": true,
+ "hide": true,
+ "iconColor": "rgba(0, 211, 255, 1)",
+ "name": "Annotations & Alerts",
+ "target": {
+ "limit": 100,
+ "matchAny": false,
+ "tags": [],
+ "type": "dashboard"
+ },
+ "type": "dashboard"
+ }
+ ]
+ },
+ "editable": true,
+ "gnetId": null,
+ "graphTooltip": 0,
+ "id": 28,
+ "links": [],
+ "panels": [
+ {
+ "datasource": null,
+ "description": "",
+ "gridPos": {
+ "h": 13,
+ "w": 24,
+ "x": 0,
+ "y": 0
+ },
+ "id": 4,
+ "options": {
+ "folderId": 1,
+ "maxItems": 10,
+ "query": "",
+ "showHeadings": true,
+ "showRecentlyViewed": true,
+ "showSearch": false,
+ "showStarred": true,
+ "tags": []
+ },
+ "pluginVersion": "8.1.0",
+ "title": "Dashboards",
+ "type": "dashlist"
+ },
+ {
+ "datasource": null,
+ "description": "",
+ "gridPos": {
+ "h": 4,
+ "w": 24,
+ "x": 0,
+ "y": 13
+ },
+ "id": 2,
+ "options": {
+ "alertName": "",
+ "dashboardAlerts": false,
+ "dashboardTitle": "",
+ "folderId": null,
+ "maxItems": 10,
+ "showOptions": "current",
+ "sortOrder": 1,
+ "stateFilter": {
+ "alerting": false,
+ "execution_error": false,
+ "no_data": false,
+ "ok": false,
+ "paused": false,
+ "pending": false
+ },
+ "tags": []
+ },
+ "pluginVersion": "8.1.0",
+ "title": "Alert list",
+ "type": "alertlist"
+ }
+ ],
+ "refresh": "",
+ "schemaVersion": 30,
+ "style": "dark",
+ "tags": [],
+ "templating": {
+ "list": []
+ },
+ "time": {
+ "from": "now-6h",
+ "to": "now"
+ },
+ "timepicker": {
+ "hidden": true,
+ "refresh_intervals": [
+ "5s",
+ "10s",
+ "30s",
+ "1m",
+ "5m",
+ "15m",
+ "30m",
+ "1h",
+ "2h",
+ "1d"
+ ],
+ "time_options": [
+ "5m",
+ "15m",
+ "1h",
+ "6h",
+ "12h",
+ "24h",
+ "2d",
+ "7d",
+ "30d"
+ ],
+ "type": "timepicker"
+ },
+ "timezone": "browser",
+ "title": "Home",
+ "uid": "RtXDCwI7z",
+ "version": 5
+}
diff --git a/ansible/roles/kube-prometheus-stack/tasks/main.yml b/ansible/roles/kube-prometheus-stack/tasks/main.yml
index e190b758..08629e38 100644
--- a/ansible/roles/kube-prometheus-stack/tasks/main.yml
+++ b/ansible/roles/kube-prometheus-stack/tasks/main.yml
@@ -10,10 +10,11 @@
dest: "{{ kube_prometheus_stack.helm_values_file }}"
content: "{{ kube_prometheus_stack.helm_values | combine(kube_prometheus_helm_values | default({}), recursive=True) | to_nice_yaml }}"
-- name: Upload custom Grafana dashboard
+- name: Upload Grafana dashboards
copy:
- src: grafana_dashboard.json
- dest: "{{ nfs_mount_path }}/kube-prometheus/kube-prometheus-grafana/dashboards/custom/"
+ src: "{{ item.src }}"
+ dest: "{{ item.dest }}"
+ loop: "{{ kube_prometheus_stack.grafana_dashboards }}"
- name: "Install Helm release {{ kube_prometheus_stack.helm_release_name }}"
community.kubernetes.helm: