2018-09-11 14:21:28 +02:00
|
|
|
---
|
|
|
|
- name: ensure apt key for grafana is present
|
|
|
|
apt_key:
|
|
|
|
state: present
|
2019-01-14 22:43:45 +01:00
|
|
|
id: 24098CB6
|
2019-01-09 14:39:50 +01:00
|
|
|
url: "https://packages.grafana.com/gpg.key"
|
2018-09-11 14:21:28 +02:00
|
|
|
|
|
|
|
- name: ensure grafana apt repo is present
|
|
|
|
apt_repository:
|
|
|
|
state: present
|
2019-01-09 14:39:50 +01:00
|
|
|
repo: "deb https://packages.grafana.com/oss/deb stable main"
|
2018-09-11 14:21:28 +02:00
|
|
|
update_cache: yes
|
|
|
|
filename: grafana
|
|
|
|
|
|
|
|
- name: install grafana package
|
|
|
|
package:
|
|
|
|
name: grafana
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: copy grafana.ini
|
2018-09-14 12:57:41 +02:00
|
|
|
template:
|
|
|
|
src: grafana.ini.j2
|
2018-09-11 14:21:28 +02:00
|
|
|
dest: /etc/grafana/grafana.ini
|
|
|
|
owner: root
|
|
|
|
group: grafana
|
|
|
|
mode: 0640
|
|
|
|
notify: restart grafana
|
|
|
|
|
|
|
|
- name: write vhost grafana.conf
|
|
|
|
template:
|
|
|
|
src: grafana_vhost.conf.j2
|
|
|
|
dest: /etc/nginx/conf.d/grafana.conf
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify: restart nginx
|
|
|
|
|
2018-09-14 13:12:24 +02:00
|
|
|
- name: install piechart panel plugin
|
|
|
|
grafana_plugin:
|
|
|
|
name: grafana-piechart-panel
|
|
|
|
version: latest
|
|
|
|
state: present
|
|
|
|
notify: restart grafana
|
|
|
|
|
2018-09-11 14:21:28 +02:00
|
|
|
- name: enable systemd unit grafana
|
|
|
|
systemd:
|
|
|
|
name: grafana-server
|
|
|
|
enabled: yes
|
|
|
|
state: started
|
2018-09-14 13:21:07 +02:00
|
|
|
|
|
|
|
- name: add yanic datasource
|
|
|
|
when: yanic_present is defined
|
|
|
|
grafana_datasource:
|
|
|
|
name: "yanic"
|
|
|
|
grafana_url: "http://localhost:3000"
|
|
|
|
grafana_user: "admin"
|
|
|
|
grafana_password: "{{ lookup('passwordstore', 'grafana/admin') }}"
|
|
|
|
ds_type: "influxdb"
|
|
|
|
url: "http://localhost:8086"
|
|
|
|
database: "yanic"
|
|
|
|
|
|
|
|
- name: add prometheus datasource
|
2018-09-24 15:12:15 +02:00
|
|
|
when: '"prometheus" in prometheus_components'
|
2018-09-14 13:21:07 +02:00
|
|
|
grafana_datasource:
|
|
|
|
name: "prometheus"
|
|
|
|
grafana_url: "http://localhost:3000"
|
|
|
|
grafana_user: "admin"
|
|
|
|
grafana_password: "{{ lookup('passwordstore', 'grafana/admin') }}"
|
|
|
|
ds_type: "prometheus"
|
|
|
|
url: "http://localhost:9090"
|