aboutsummaryrefslogtreecommitdiffstats
path: root/roles/grafana/tasks/main.yml
blob: 919f15e61fae20700ed6b46b40e5a2bb45725ff1 (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

# grafana ~~ roles/grafana/tasks/main.yml
# grafana setup

---

- name: install grafana
  package: name=grafana state=present

- name: ensure grafana dir exists
  file:
    path: "{{ grafana_dir }}"
    owner: "{{ grafana_user }}"
    group: "{{ grafana_group }}"
    mode: 0640
    state: directory

- name: generate grafana configuration
  template:
    src: grafana.ini.j2
    dest: /etc/grafana.ini
    owner: "{{ user_root }}"
    group: "{{ group_root }}"
    mode: 0644

- name: generate reverse proxy configuration for nginx
  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"

- name: start and enable grafana service
  service: name=grafana state=restarted enabled=true
remember that computers suck.