Skip to content

Ansible role to configure grafana + datasources + dashboards in one flow, ATM focused around Prometheus

License

Notifications You must be signed in to change notification settings

shelleg/ansible-role-grafana

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible role: grafana

A Simple Ansible role to manage grafana, configure datasources [ well just Prometheus ATM] and import dashboards.

Here's what it does:

  • Install grafana package and dependencies and start service
  • Update default password
  • Install grafana plugins
  • Configure Prometheus datasource
  • Import dashboards from the files directory into /var/lib/grafana/dsahboards

TODO / WIP (Pull request anyone ? ;)

  • Add support of adding grafana dashboards via git

Role Variables

role flags:

  • grafana_configure: true - if you want no configuration this is the option for you to set to false
  • grafana_prometehus: true - configures grafana with a datasource named Prometheus as the default datasource.

Variables worth mentioning:

  • grafana_http_port: 3000

  • grafana_admin_user: admin

  • grafana_admin_password: admin123

  • Grafana plugins using grafana-cli:

      grafana_plugins:
        - grafana-clock-panel
        - grafana-simple-json-datasource
        - grafana-worldmap-panel
        - grafana-piechart-panel
        - digiapulssi-breadcrumb-panel
        - crate-datasource
    

In production I don't want people changing dashboards without going through Git ... hence this method seemed sufficient

  • grafana_dir_dashboards: /var/lib/grafana/dashboards
  • TODO move to git based population ...

Prometheus Integration:

  • grafana_prometehus: true
  • grafana_prometehus_host: localhost
  • grafana_prometehus_port: 9090
  • TODO: look at authentication

Grafana Database:

  grafana_database:
    type: sqlite3
    host: 127.0.0.1:3306
    name: grafana
    user: root
    password: ''
    path: grafana.db

TODO: Check other storage options

Example Playbook

- hosts: centos,ubuntu
  roles:
    - shelleg.grafana

License

Apache 2

Author Information

Haggai Philip Zagury

About

Ansible role to configure grafana + datasources + dashboards in one flow, ATM focused around Prometheus

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages