grafana auth, notifications

main
Alpha Chen 3 weeks ago
parent b0710a20dd
commit 863a776490
Signed by: alpha
SSH Key Fingerprint: SHA256:3fOT8fiYQG/aK9ntivV3Bqtg8AYQ7q4nV6ZgihOA20g

@ -6,11 +6,17 @@
version: 11.2.1 version: 11.2.1
tasks: tasks:
- name: Grafana user
ansible.builtin.user:
name: grafana
register: grafana_user
- name: Create Grafana dir - name: Create Grafana dir
ansible.builtin.file: ansible.builtin.file:
path: /mnt/lotus-land-story/grafana/provisioning/{{ item }} path: /mnt/lotus-land-story/grafana/provisioning/{{ item }}
state: directory state: directory
mode: "0755" mode: "0755"
owner: "{{ grafana_user.name }}"
loop: loop:
- datasources - datasources
@ -18,6 +24,9 @@
ansible.builtin.copy: ansible.builtin.copy:
dest: /mnt/lotus-land-story/grafana/grafana.ini dest: /mnt/lotus-land-story/grafana/grafana.ini
content: | content: |
[log]
# level = debug
[metrics] [metrics]
enabled = true enabled = true
disable_total_stats = false disable_total_stats = false
@ -32,6 +41,7 @@
oauth_allow_insecure_email_lookup = true oauth_allow_insecure_email_lookup = true
disable_signout_menu = true disable_signout_menu = true
# https://www.authelia.com/integration/openid-connect/grafana/
[auth.generic_oauth] [auth.generic_oauth]
enabled = true enabled = true
name = Authelia name = Authelia
@ -48,7 +58,17 @@
name_attribute_path = name name_attribute_path = name
use_pkce = true use_pkce = true
auto_login = true auto_login = true
mode: "0644" role_attribute_path = contains(groups, 'admin') && 'Admin' || contains(groups, 'editor') && 'Editor' || 'Viewer'
allow_assign_grafana_admin = true
[smtp]
enabled = true
host = smtp.sendgrid.net:465
user = apikey
password = {{ grafana.smtp_password }}
from_address = grafana@kejadlen.dev
mode: "0600"
owner: "{{ grafana_user.name }}"
- name: Provision Prometheus - name: Provision Prometheus
ansible.builtin.copy: ansible.builtin.copy:
@ -88,5 +108,6 @@
- name: lotus_land_story - name: lotus_land_story
etc_hosts: etc_hosts:
host.docker.internal: host-gateway host.docker.internal: host-gateway
user: "{{ grafana_user.uid }}"
# vim: ft=yaml.ansible # vim: ft=yaml.ansible

Loading…
Cancel
Save