-
Notifications
You must be signed in to change notification settings - Fork 13
/
graphite-grafana.yml
122 lines (93 loc) · 3.54 KB
/
graphite-grafana.yml
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
---
- name: graphite-grafana
hosts: graphite-grafana
sudo: yes
pre_tasks:
- name: apt-get update
apt: update_cache=yes
roles:
- role: nginx
nginx_events_params:
- worker_connections 512
- use epoll
- multi_accept on
nginx_sites:
default:
- listen 80
- proxy_headers_hash_max_size 1024
- server_name localhost
- root /srv/www
- location /grafana {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
rewrite ^/grafana/(.*) /$1 break;
proxy_pass http://localhost:3000;
}
- location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:3031;
}
nginx_configs:
gzip:
- gzip on
- gzip_disable msie6
tasks:
- name: "add grafana apt repository"
apt_repository: repo="deb https://packagecloud.io/grafana/stable/debian/ wheezy main" state=present
- name: "install packagecloud key"
shell: "curl https://packagecloud.io/gpg.key | sudo apt-key add -"
- name: "update apt cache"
apt: update_cache=yes
- name: "install grafana"
apt: name=grafana state=present
- name: "autostart grafana-server"
service: name=grafana-server enabled=yes
notify:
- restart grafana
- name: "copy grafana config file"
template: src=templates/etc/grafana/grafana.ini.j2 dest=/etc/grafana/grafana.ini
notify:
- restart grafana
- name: install graphite-carbon
apt: name=graphite-carbon state=present
- name: "copy carbon config"
template: src=templates/etc/default/graphite-carbon.j2 dest=/etc/default/graphite-carbon
notify:
- restart carbon-cache
- name: "install graphite-web"
apt: name=graphite-web state=present
- name: "install graphite-carbon"
apt: name=graphite-carbon state=present
- name: "install uwsgi-plugin-python"
apt: name=uwsgi-plugin-python state=present
- name: "install uwsgi"
apt: name=uwsgi state=present
- name: "copy uwsgi config"
template: src=templates/etc/uwsgi/apps-available/graphite.ini.j2 dest=/etc/uwsgi/apps-available/graphite.ini
notify: restart uwsgi
- name: "activate graphite config"
file: src=/etc/uwsgi/apps-available/graphite.ini dest=/etc/uwsgi/apps-enabled/graphite.ini state=link
notify: restart uwsgi
- name: "autostart uwsgi"
service: name=uwsgi enabled=yes
notify: restart uwsgi
- name: "create graphite log dir"
file: path=/var/log/graphite state=directory mode=0755 owner=_graphite group=_graphite
- name: sync carbon database
command: graphite-manage syncdb --noinput creates=/var/lib/graphite/graphite.db
- name: adjust carbon database permissions
file: path=/var/lib/graphite/graphite.db owner=_graphite group=_graphite
notify: restart uwsgi
- name: adjust graphite search index permissions
file: path=/var/lib/graphite/search_index group=www-data state=touch
notify: restart uwsgi
- name: "add www-data to _graphite group"
user: name=www-data groups=_graphite append=yes
handlers:
- name: restart carbon-cache
service: name=carbon-cache state=restarted
- name: restart grafana
service: name=grafana-server state=restarted
- name: restart uwsgi
service: name=uwsgi state=restarted