Initial commit

This commit is contained in:
nd 2019-11-02 14:28:22 +01:00
commit 6f51a68160
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
5 changed files with 71 additions and 0 deletions

53
tasks/main.yml Normal file
View file

@ -0,0 +1,53 @@
- name: install grafana
apt:
pkg: grafana
- name: set admin password
command:
argv:
- grafana-cli
- admin
- reset-admin-password
- "{{ grafana.adminpw }}"
- name: install grafana plugins
grafana_plugin:
name: "{{ item }}"
loop: "{{ grafana.plugins.keys()|list }}"
notify: restart grafana
- name: update all grafana plugins
tags: update
command: grafana-cli plugins update-all
notify: restart grafana
- name: "ensure grafana is started"
service:
name: grafana-server
enabled: true
state: started
- name: "Check if grafana is accessible."
uri:
url: http://127.0.0.1:3000
method: GET
status_code: 200
- name: create data sources
loop: "{{ grafana.datasources }}"
grafana_datasource:
name: "{{ item.name }}"
grafana_url: "http://127.0.0.1:3000"
grafana_user: "admin"
grafana_password: "{{ grafana.adminpw }}"
ds_type: "{{ item.ds_type }}"
url: "{{ item.url }}"
- name: import dashboards
loop: "{{ grafana.dashboards }}"
grafana_dashboard:
grafana_url: "http://127.0.0.1:3000"
grafana_user: "admin"
grafana_password: "{{ grafana.adminpw }}"
path: {{ item.path }}