Initial commit
This commit is contained in:
commit
6f51a68160
5 changed files with 71 additions and 0 deletions
53
tasks/main.yml
Normal file
53
tasks/main.yml
Normal 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 }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue