From 3f36f665f95f8fe754ce8d39782918a829aefd2f Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 7 Sep 2017 14:52:06 -0600 Subject: [PATCH] Set timezone in Graphite's config 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 --- .../ceph-grafana/tasks/configure_graphite_web.yml | 13 +++++++++++++ ansible/roles/cephmetrics-common/defaults/main.yml | 3 +++ 2 files changed, 16 insertions(+) diff --git a/ansible/roles/ceph-grafana/tasks/configure_graphite_web.yml b/ansible/roles/ceph-grafana/tasks/configure_graphite_web.yml index b2c41e3..5a02be4 100644 --- a/ansible/roles/ceph-grafana/tasks/configure_graphite_web.yml +++ b/ansible/roles/ceph-grafana/tasks/configure_graphite_web.yml @@ -58,3 +58,16 @@ 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 diff --git a/ansible/roles/cephmetrics-common/defaults/main.yml b/ansible/roles/cephmetrics-common/defaults/main.yml index c4f7fa6..73e8f9c 100644 --- a/ansible/roles/cephmetrics-common/defaults/main.yml +++ b/ansible/roles/cephmetrics-common/defaults/main.yml @@ -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 -- 2.47.3