From fe9c36ab953e25e5d0ba20fd70ce4702b52871f2 Mon Sep 17 00:00:00 2001 From: Radoslaw Jablonski Date: Mon, 8 Oct 2018 14:43:09 +0100 Subject: ansible: Add cleanup for grafana cache under host machine Previously cleaning cache directory for grafana(/var/lib/grafana) was missing and, because of that, changing influxdb_host variable value between one ansible deployment and another was not working. It was a problem because scripts in grafana container are expecting that cache directory will be empty during first run and, if some dashboards exists in cache already (even if they are left by previous deployment), old dashboards will be left untouched with possibly wrong configuration. This bug happened during deploying 3 nodes scenarios more than once (collectd, grafana and influlxdb hosted on separate machines). Now cleanup is done by default and can be skipped using 'clean_grafana_cache=false' value. Change-Id: Ib67cc3437b8a3a2c2930dd55cba44aef8e352cf2 Signed-off-by: Radoslaw Jablonski (cherry picked from commit 1ff5c221b795245cd77fff9b2d0387b7146f8fe9) --- docker/ansible/roles/run_grafana/tasks/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docker/ansible/roles/run_grafana/tasks/main.yml b/docker/ansible/roles/run_grafana/tasks/main.yml index 230d6ec6..ea4ca8b9 100644 --- a/docker/ansible/roles/run_grafana/tasks/main.yml +++ b/docker/ansible/roles/run_grafana/tasks/main.yml @@ -34,6 +34,12 @@ - set_fact: influxdb_host_ip_mapping: "{ '{{ influxdb_hostname }}': '{{ influxdb_host_ip }}' }" +- name: Cleanup barometer-grafana cache directory under host + file: + path: /var/lib/grafana + state: absent + when: clean_grafana_cache|default(true)|bool == true + - name: launch barometer-grafana container docker_container: name: bar-grafana -- cgit 1.2.3-korg