diff options
Diffstat (limited to 'roles/grafana/tasks')
-rw-r--r-- | roles/grafana/tasks/main.yml | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/roles/grafana/tasks/main.yml b/roles/grafana/tasks/main.yml index 919f15e..d002b51 100644 --- a/roles/grafana/tasks/main.yml +++ b/roles/grafana/tasks/main.yml @@ -1,36 +1,39 @@ - -# grafana ~~ roles/grafana/tasks/main.yml -# grafana setup - ---- - - name: install grafana - package: name=grafana state=present + package: + name: grafana + state: present -- name: ensure grafana dir exists +- name: ensure grafana directories exists file: - path: "{{ grafana_dir }}" + path: "{{ grafana_dir }}/{{ item }}" owner: "{{ grafana_user }}" group: "{{ grafana_group }}" - mode: 0640 + mode: "0640" state: directory + loop: + - "" + - "data" + - "logs" + - "plugins" - name: generate grafana configuration template: - src: grafana.ini.j2 + src: etc-grafana.ini.j2 dest: /etc/grafana.ini - owner: "{{ user_root }}" - group: "{{ group_root }}" - mode: 0644 + owner: "0" + group: "0" + mode: "0644" -- name: generate reverse proxy configuration for nginx +- name: generate grafana data sources template: - src: grafana.conf.nginx.j2 - dest: /etc/nginx/conf.d/grafana.conf - owner: "{{ user_root }}" - group: "{{ group_root }}" - mode: 0644 - when: ansible_distribution != "OpenBSD" + src: datasources-default.yml.j2 + dest: /etc/grafana/provisioning/datasources/default.yml + owner: "{{ grafana_user }}" + group: "{{ grafana_group }}" + mode: "0640" - name: start and enable grafana service - service: name=grafana state=restarted enabled=true + service: + name: grafana + state: restarted + enabled: true |