From 5ca414a0bb3bdb6d985afdfd8b2003563b10f2d9 Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Fri, 29 Apr 2016 09:34:27 +0200
Subject: [PATCH] Include local netdata config into hosts playbook

---
 tasks/main.yml            | 11 +++++++++++
 templates/tv-company.html |  6 +-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/tasks/main.yml b/tasks/main.yml
index 766bf07..a3f7949 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -39,6 +39,15 @@
     - "Include NetData to Boot-List"
     - "Start NetData"
 
+- name: "Check if local netdata installation exists"
+  shell: ls /usr/share/netdata/web/index.html
+  delegate_to: localhost
+  run_once: true
+  register: netdata_local_available
+  failed_when: false
+  changed_when: false
+  tags: 'LocalConfig'
+
 - name: "Install local dashboard"
   template:
     src=tv-company.html
@@ -48,6 +57,8 @@
     mode=644
   delegate_to: localhost
   run_once: true
+  tags: 'LocalConfig'
+  when: netdata_local_available.stdout == '/usr/share/netdata/web/index.html'
 
 - name: "Configure FireQoS"
   template:
diff --git a/templates/tv-company.html b/templates/tv-company.html
index 5ffebbb..d68472e 100644
--- a/templates/tv-company.html
+++ b/templates/tv-company.html
@@ -18,11 +18,7 @@
 	<script>
 	NETDATA.options.current.destroy_on_hide = true;
 	NETDATA.options.current.eliminate_zero_dimensions = true;
-	NETDATA.options.current.stop_updates_when_focus_is_lost = false;
-	var RELOAD_EVERY = 5;
-	setTimeout(function(){
-		location.reload();
-	}, RELOAD_EVERY * 60 * 1000);
+	NETDATA.options.current.stop_updates_when_focus_is_lost = true;
 	</script>
 
 </head>
-- 
GitLab