You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.9 KiB

- name: Set up Grafana
hosts: lotus-land-story
vars_files:
- vars.yml
2 months ago
vars:
version: 11.2.1
tasks:
- name: Create Grafana dir
ansible.builtin.file:
path: /mnt/lotus-land-story/grafana/provisioning/{{ item }}
state: directory
mode: "0755"
loop:
- datasources
2 years ago
- name: Configure Grafana
ansible.builtin.copy:
dest: /mnt/lotus-land-story/grafana/grafana.ini
content: |
[metrics]
enabled = true
disable_total_stats = false
4 weeks ago
2 years ago
[server]
domain = grafana.{{ domain }}
2 years ago
http_addr = 0.0.0.0
1 year ago
root_url = https://grafana.{{ domain }}
4 weeks ago
# https://grafana.com/docs/grafana/latest/setup-grafana/configure-security/configure-authentication
[auth]
oauth_allow_insecure_email_lookup = true
disable_signout_menu = true
1 year ago
[auth.generic_oauth]
enabled = true
name = Authelia
icon = signin
client_id = grafana
client_secret = {{ grafana.oauth_secret }}
scopes = openid profile email groups
empty_scopes = false
auth_url = https://auth.{{ domain }}/api/oidc/authorization
token_url = https://auth.{{ domain }}/api/oidc/token
api_url = https://auth.{{ domain }}/api/oidc/userinfo
login_attribute_path = preferred_username
groups_attribute_path = groups
name_attribute_path = name
use_pkce = true
4 weeks ago
auto_login = true
mode: "0644"
2 years ago
- name: Provision Prometheus
ansible.builtin.copy:
dest: /mnt/lotus-land-story/grafana/provisioning/datasources/prometheus.yml
content: |
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
# Access mode - proxy (server in the UI) or direct (browser in the UI).
access: proxy
url: http://prometheus:9090
jsonData:
httpMethod: POST
manageAlerts: true
prometheusType: Prometheus
prometheusVersion: 2.37.0
mode: "0644"
- name: Create Grafana volume
community.docker.docker_volume:
name: grafana
- name: Run Grafana
community.docker.docker_container:
name: grafana
2 months ago
image: grafana/grafana-oss:{{ version }}
volumes:
- /mnt/lotus-land-story/grafana/grafana.ini:/etc/grafana/grafana.ini
- /mnt/lotus-land-story/grafana/provisioning:/etc/grafana/provisioning
- grafana:/var/lib/grafana
2 months ago
env:
GF_INSTALL_PLUGINS: https://storage.googleapis.com/integration-artifacts/grafana-lokiexplore-app/grafana-lokiexplore-app-latest.zip;grafana-lokiexplore-app
restart_policy: unless-stopped
networks:
- name: lotus_land_story
etc_hosts:
host.docker.internal: host-gateway
# vim: ft=yaml.ansible