summaryrefslogtreecommitdiff
path: root/roles/monitoring/graphite/web/tasks/main.yml
blob: e450fac4d4c5ec1992083a66f1d9dfbcd8c52074 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
---
- name: instsall apt packages
  apt:
    name: graphite-web
    state: present

- name: configure secret key
  lineinfile:
    path: /etc/graphite/local_settings.py
    regexp: '#?SECRET_KEY\s*='
    line: "SECRET_KEY = '{{ graphite_web_secret_key }}'"

- name: initialize database
  become: yes
  become_method: su
  become_user: "_graphite"
  become_flags: "-s /bin/bash"
  command: graphite-manage migrate --run-syncdb
  args:
    creates: /var/lib/graphite/graphite.db

- name: fix sqlite database permissions
  file:
    path: /var/lib/graphite/graphite.db
    owner: "_graphite"
    group: "_graphite"
    mode: "0600"

- name: check if uwsgi plugin python3 is installed
  assert:
    msg: "This role needs uwsgi with python3 plugin installed"
    that:
      - uwsgi_plugins is defined
      - "'python3' in uwsgi_plugins"

- name: install uwsgi app
  vars:
    uwsgi_app:
      name: graphite
      content: "{{ lookup('template', 'uwsgi-app.ini.j2') }}"
  include_role:
    name: uwsgi/app

- name: render nginx-vhost config template
  set_fact:
    graphite_web_nginx_vhost_content: "{{ lookup('template', 'nginx-vhost.conf.j2') }}"

- name: install nginx vhost
  vars:
    nginx_vhost:
      name: graphite
      content: "{{ graphite_web_nginx_vhost_content }}"
  include_role:
    name: nginx/vhost