infra/roles/monitoring-server/tasks/grafana.yml

75 lines
1.8 KiB
YAML

---
- name: template grafana config
template:
src: grafana.ini.j2
dest: /etc/grafana/grafana.ini
notify:
- restart grafana
tags:
- grafana-config
- name: ensure ownership
file:
path: /var/lib/grafana
owner: grafana
group: grafana
recurse: true
- name: nginx vhost
template:
src: 01-grafana.j2
dest: /etc/nginx/sites-enabled/01-grafana
tags:
- grafana-config
- grafana-nginx
- nginx-grafana
- nginx
notify: reload nginx
# - name: Create influxdb datasources
# grafana_datasource:
# name: "influxdb-{{ item.key }}"
# grafana_url: "http://localhost:{{ grafana_port }}"
# #grafana_url: "https://{{ grafana_url }}"
# grafana_user: "{{ grafana_admin_user }}"
# grafana_password: "{{ grafana_admin_password }}"
# ds_type: "influxdb"
# ds_url: "http://localhost:{{ influxdb_port}}"
# database: "{{ item.key }}"
# user: "{{ item.key }}"
# org_id: 1
# additional_secure_json_data:
# password: "{{ item.value }}"
# #password: "{{ item.value }}"
# #basic_auth_user: "{{ item.key }}"
# #basic_auth_password: "{{ item.value }}"
# #user: "{{ influxdb_admin_user }}"
# #password: "{{ influxdb_admin_password }}"
# #basic_auth_user: "{{ influxdb_admin_user }}"
# #basic_auth_password: "{{ influxdb_admin_password }}"
# time_interval: "1m"
# with_items: "{{ influxdb_user_database | dict2items }}"
# loop_control:
# label: "{{ item.key }}"
# tags:
# - grafana-ds
- name: remove grafna image render plugin
grafana_plugin:
name: grafana-image-renderer
version: latest
state: absent
ignore_errors: yes
- name: template snapshot.py
template:
src: snapshot.py
dest: /usr/local/bin/snapshot.py
owner: root
group: root
mode: 0755
tags:
- sensor-snapshot