mullholland.grafana_docker
Ansible role grafana_docker
Installs and configures grafana container based on official grafana docker container
| GitHub | Downloads | Version |
|---|---|---|
Example Playbook
This example is taken from molecule/default/converge.yml and is tested on each push, pull request and release.
---
- name: Converge
hosts: all
become: true
gather_facts: true
vars:
adguardhome_docker_config:
tls:
options:
modern:
minVersion: "VersionTLS13"
sniStrict: true
roles:
- role: "mullholland.grafana_docker"
The machine needs to be prepared. In CI this is done using molecule/default/prepare.yml:
---
- name: Prepare
hosts: all
become: true
gather_facts: true
vars:
pip_packages:
- "docker"
roles:
- role: mullholland.docker
- role: mullholland.repository_epel
- role: mullholland.pip
Role Variables
The default values for the variables are set in defaults/main.yml:
---
# General config
grafana_docker_network_name: "web"
grafana_docker_base_path: "/opt"
grafana_docker_timezone: "Europe/Berlin"
# User/Group of the stack. Everything is mapped to this, instead of root.
grafana_docker_user: "homelab"
grafana_docker_uid: "900"
grafana_docker_group: "homelab"
grafana_docker_gid: "900"
grafana_docker_user_system: true
# which container version to install
# https://hub.docker.com/r/grafana/grafana/tags
# can also be latest
grafana_docker_version: "grafana/grafana:latest"
# additional docker compose environment varaibles
# https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#override-configuration-with-environment-variables
grafana_docker_environment_variables:
- "GF_INSTALL_PLUGINS: 'grafana-clock-panel, grafana-simple-json-datasource'"
grafana_docker_volumes:
- "/opt/grafana/data:/var/lib/grafana"
- "/opt/grafana/provisioning:/etc/grafana/provisioning"
# which port to expose. can be empty
grafana_docker_ports:
- "3000:3000/tcp" # WebUI
grafana_docker_labels:
- "traefik.enable=false"
# - "traefik.enable=true"
# - "traefik.http.routers.grafana.entryPoints=https"
# - "traefik.http.routers.grafana.rule=Host(`grafana.example.com`)"
# - "traefik.http.routers.grafana.tls.certResolver=letsEncrypt"
# - "traefik.http.routers.grafana.tls=true"
# - "traefik.http.routers.grafana.service=grafana"
# - "traefik.http.routers.grafana.loadbalancer.server.port=80"
grafana_docker_provision_datasources:
- name: VictoriaMetrics
type: prometheus
access: proxy
url: http://victoriametrics:8428
isDefault: true
jsonData:
prometheusType: Prometheus
prometheusVersion: 2.24.0
- name: Loki
type: loki
access: proxy
url: http://loki:3100
jsonData:
timeout: 60
maxLines: 10000
- name: VMAlert
type: alertmanager
url: http://vmalert:8880
access: proxy
jsonData:
# Valid options for implementation include mimir, cortex and prometheus
implementation: prometheus
# Whether or not Grafana should send alert instances to this Alertmanager
handleGrafanaManagedAlerts: false
# Creates the provison config.
# You can put any dashboards json files into the provision folder outsie the container
# and grafnaa will automatically deploy it
grafana_docker_provision_dashboards:
- name: dashboards
type: file
updateIntervalSeconds: 30
options:
path: /var/lib/provision/dashboards
foldersFromFilesStructure: true
Requirements
- pip packages listed in requirements.txt.
State of used roles
The following roles are used to prepare a system. You can prepare your system in another way.
| Requirement | GitHub | GitLab |
|---|---|---|
| mullholland.repository_epel | ||
| mullholland.docker | ||
| mullholland.pip |
Context
This role is a part of many compatible roles. Have a look at the documentation of these roles for further information.
Here is an overview of related roles:

Compatibility
This role has been tested on these container images:
| container | tags |
|---|---|
| EL | all |
| Fedora | 38, 39 |
| Ubuntu | all |
| Debian | all |
The minimum version of Ansible required is 2.10, tests have been done to:
- The previous version.
- The current version.
- The development version.
If you find issues, please register them in GitHub.
License
MIT.
Author Information
Installs and configures grafana container based on official grafana docker container
ansible-galaxy install mullholland.grafana_docker