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.
Laur Ivan 379f47e0ba chore(release): 1.1.5 1 year ago
.github feat: Add grafana role. 1 year ago
defaults feat! Add prometheus. 1 year ago
handlers feat: Add grafana role. 1 year ago
meta feat: Add grafana role. 1 year ago
molecule feat! Add prometheus. 1 year ago
tasks feat! Add prometheus. 1 year ago
templates fix: Persist grafana data 1 year ago
tests feat: Add grafana role. 1 year ago
vars feat! Add prometheus. 1 year ago
.gitignore feat: Add grafana role. 1 year ago
.travis.yml feat: Add grafana role. 1 year ago
.yamllint feat: Add grafana role. 1 year ago
CHANGELOG.md chore(release): 1.1.5 1 year ago
LICENSE feat: Add grafana role. 1 year ago
README.md chore: Update README. 1 year ago
TODO.md feat: Add grafana role. 1 year ago

README.md

laurivan.grafana

This role installs Grafana, InfluxDB and Prometheus via Docker.

Requirements

None

Role Variables

All variables are listed below (see also defaults/main.yml).

Paths and Volumes

All paths are by default defined as relative to grafana_volume_base:

grafana_volume_base: "/mnt/data/grafana"
grafana_setup_path: "{{ grafana_volume_base }}/config"
grafana_volume_grafana: "{{ grafana_volume_base }}/grafana"
grafana_volume_influxdb: "{{ grafana_volume_base }}/influxdb"
grafana_volume_prometheus: "{{ grafana_volume_base }}/prometheus"

You can however define specific volumes for the individual items:

  • grafana_setup_path - where the Docker compose files are placed
  • grafana_volume_grafana - volume for the grafana docker container
  • grafana_volume_influxdb - volume for InfluxDB
  • grafana_volume_prometheus - volume for Prometheus.io

InfluxDB

We define the following variables for InfluxDB:

influxdb:
  username: influxdb
  password: change_me
  org: example.com
  bucket: my_bucket
  admin_token: change_me

Prometheus

We define Prometheus variables:

prometheus_port: "9090"

grafana_prometheus_project: my-project
grafana_prometheus_job_name: prometheus
grafana_prometheus_scrape_interval: '120s'
grafana_prometheus_targets:
  - "10.0.0.35:9100"
  - "10.0.0.35:8080"

The targets are locations (ip address + port) where Prometheus polls for new data. This can be cadvisor or node exporter for example.

Note: Prometheus should be an internal service (i.e., empty prometheus_port). Hence, it doesn't have any security in place.

Grafana

We also define several variables for grafana

grafana:
  username: changeme
  password: changeme

Just in case, you can override the user/group for grafana via:

grafana_uid:
grafana_gid:

Dependencies

You need a machine with docker and docker-compose installed.

Example Playbook

- hosts: servers
  roles:
      - 'laurivan.grafana'

License

MIT

Author Information

This role was created in 2022 by Laur Ivan.