diff --git a/playbooks/roles/grafana/files/home.json b/playbooks/roles/grafana/files/home.json new file mode 100644 index 0000000000..6766778327 --- /dev/null +++ b/playbooks/roles/grafana/files/home.json @@ -0,0 +1,86 @@ +{ + "links": [], + "panels": [ + { + "gridPos": { + "h": 8, + "w": 12, + "x": 6, + "y": 0 + }, + "id": 5, + "options": { + "content": "\n\nWelcome to OpenDev Grafana\n\nThe following dashboards are populated automatically. Contributions are welcome in the [project-config](https://opendev.org/openstack/project-config/src/branch/master/grafana) repository.", + "mode": "markdown" + }, + "pluginVersion": "8.4.3", + "title": "OpenDev Grafana", + "transparent": true, + "type": "text" + }, + { + "gridPos": { + "h": 50, + "w": 18, + "x": 3, + "y": 8 + }, + "id": 3, + "links": [], + "options": { + "folderId": 0, + "maxItems": 50, + "query": "", + "showHeadings": false, + "showRecentlyViewed": false, + "showSearch": true, + "showStarred": false, + "tags": [] + }, + "pluginVersion": "8.4.3", + "tags": [], + "title": "Dashboards", + "transparent": true, + "type": "dashlist" + } + ], + "schemaVersion": 35, + "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": "OpenDev Home" +} diff --git a/playbooks/roles/grafana/tasks/main.yaml b/playbooks/roles/grafana/tasks/main.yaml index 758fe9dd6f..e68e3a51c4 100644 --- a/playbooks/roles/grafana/tasks/main.yaml +++ b/playbooks/roles/grafana/tasks/main.yaml @@ -41,6 +41,22 @@ group: root mode: 0644 +- name: Ensure home panel directory exists + file: + state: directory + path: /etc/grafana/home + owner: root + group: root + mode: 0755 + +- name: Copy home panel + copy: + src: 'home.json' + dest: '/etc/grafana/home/home.json' + owner: root + group: root + mode: 0644 + - name: Write update script template: src: update-grafana-dashboards.sh.j2 diff --git a/playbooks/roles/grafana/templates/docker-compose.yaml.j2 b/playbooks/roles/grafana/templates/docker-compose.yaml.j2 index d0c54cb651..d02f564756 100644 --- a/playbooks/roles/grafana/templates/docker-compose.yaml.j2 +++ b/playbooks/roles/grafana/templates/docker-compose.yaml.j2 @@ -13,5 +13,7 @@ services: GF_SECURITY_SECRET_KEY__FILE: '/etc/grafana/secrets/secret_key' GF_AUTH_ANONYMOUS_ENABLED: 'true' GF_USERS_ALLOW_SIGN_UP: 'false' + GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH: '/etc/grafana/home/home.json' volumes: - - /etc/grafana/secrets:/etc/grafana/secrets + - /etc/grafana/secrets:/etc/grafana/secrets:ro + - /etc/grafana/home:/etc/grafana/home:ro