summaryrefslogtreecommitdiff
path: root/roles/monitoring/graphite/web/tasks/main.yml
blob: 7c796722985462cdd6ebe530c3b0e6ea83a785a8 (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
---
- 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: install nginx vhost
  vars:
    nginx_vhost:
      name: graphite
      content: "{{ lookup('template', 'nginx-vhost.conf.j2') }}"
  include_role:
    name: nginx/vhost