aboutsummaryrefslogtreecommitdiffstats
path: root/roles/grafana/tasks/main.yml
blob: 1044119482eb2b17aa332d22746087606a580742 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---

- name: install grafana
  ansible.builtin.package:
    name: grafana
    state: present

- name: create grafana directory
  ansible.builtin.file:
    path: "{{ grafana_dir }}/{{ item }}"
    owner: "{{ grafana_user }}"
    group: "{{ grafana_group }}"
    mode: "0640"
    state: directory
  loop:
    - ""
    - data
    - logs
    - plugins

- name: generate grafana configuration
  ansible.builtin.template:
    src: grafana.ini.j2
    dest: "{{ grafana_configuration_file }}"
    owner: 0
    group: 0
    mode: "0644"

- name: generate grafana data sources
  ansible.builtin.template:
    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
  ansible.builtin.service:
    name: grafana
    state: restarted
    enabled: true
remember that computers suck.