summaryrefslogtreecommitdiff
path: root/roles/monitoring/graphite/web/tasks/main.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/monitoring/graphite/web/tasks/main.yml')
-rw-r--r--roles/monitoring/graphite/web/tasks/main.yml50
1 files changed, 50 insertions, 0 deletions
diff --git a/roles/monitoring/graphite/web/tasks/main.yml b/roles/monitoring/graphite/web/tasks/main.yml
new file mode 100644
index 00000000..7c796722
--- /dev/null
+++ b/roles/monitoring/graphite/web/tasks/main.yml
@@ -0,0 +1,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