]> git-server-git.apps.pok.os.sepia.ceph.com Git - cephmetrics.git/commitdiff
Set timezone in Graphite's config 116/head
authorZack Cerza <zack@redhat.com>
Thu, 7 Sep 2017 20:52:06 +0000 (14:52 -0600)
committerZack Cerza <zack@redhat.com>
Thu, 7 Sep 2017 20:52:06 +0000 (14:52 -0600)
Oddly, graphite defaults to using a hardcoded timezone rather than the
system's. This throws off queries, so let's configure it.

Signed-off-by: Zack Cerza <zack@redhat.com>
ansible/roles/ceph-grafana/tasks/configure_graphite_web.yml
ansible/roles/cephmetrics-common/defaults/main.yml

index b2c41e33b32099506f6dfbdf75c74691508d9017..5a02be46a727f0932abb98ccb29d96ea70cf12f5 100644 (file)
     state: present
   when: ansible_pkg_mgr == "yum"
   notify: Restart graphite-web
+
+- name: Get timezone
+  shell: "timedatectl | grep 'Time zone'"
+  register: timezone
+
+- name: Set timezone in local_settings.py
+  lineinfile:
+    dest: "{{ graphite.app_conf[ansible_pkg_mgr] }}"
+    line: "TIME_ZONE = '{{ timezone.stdout.strip().split(' ')[2] }}'"
+    regexp: "^TIME_ZONE = .*"
+    insertafter: '^#TIME_ZONE = .*'
+    state: present
+  notify: Restart graphite-web
index c4f7fa624beba558726e92eb0b7dac172c7131e4..73e8f9c4e2844e4ef258bcd0f2800c9963d0a59c 100644 (file)
@@ -25,6 +25,9 @@ defaults:
     site_conf:
       yum: '/etc/httpd/conf.d/graphite-web.conf'
       apt: '/etc/apache2/sites-available/graphite-web.conf'
+    app_conf:
+      yum: '/etc/graphite-web/local_settings.py'
+      apt: '/etc/graphite/local_settings.py'
   carbon:
     unix_user:
       yum: carbon