Merge pull request #20 from simonpasquier/fix-influxdb-configuration

Fix InfluxDB parameters
diff --git a/grafana/client/single.yml b/grafana/client/single.yml
index c36d4ff..49ac876 100644
--- a/grafana/client/single.yml
+++ b/grafana/client/single.yml
@@ -17,7 +17,7 @@
           type: influxdb
           host: ${_param:grafana_influxdb_host}
           port: ${_param:influxdb_port}
-          user: ${_param:influxdb_user}
-          password: ${_param:influxdb_password}
-          database: ${_param:influxdb_database}
+          user: lma
+          password: ${_param:influxdb_stacklight_password}
+          database: lma
           is_default: true
diff --git a/heka/aggregator/cluster.yml b/heka/aggregator/cluster.yml
index 455dbb1..993cb35 100644
--- a/heka/aggregator/cluster.yml
+++ b/heka/aggregator/cluster.yml
@@ -9,9 +9,9 @@
     aggregator:
       influxdb_host: ${_param:heka_influxdb_host}
       influxdb_port: ${_param:influxdb_port}
-      influxdb_database: ${_param:influxdb_database}
-      influxdb_username: ${_param:influxdb_user}
-      influxdb_password: ${_param:influxdb_password}
+      influxdb_database: lma
+      influxdb_username: lma
+      influxdb_password: ${_param:influxdb_stacklight_password}
       nagios_host: ${_param:nagios_host}
       nagios_username: ${_param:nagios_username}
       nagios_password: ${_param:nagios_password}
diff --git a/heka/aggregator/single.yml b/heka/aggregator/single.yml
index 4b1c71f..47710f7 100644
--- a/heka/aggregator/single.yml
+++ b/heka/aggregator/single.yml
@@ -9,9 +9,9 @@
     aggregator:
       influxdb_host: ${_param:heka_influxdb_host}
       influxdb_port: ${_param:influxdb_port}
-      influxdb_database: ${_param:influxdb_database}
-      influxdb_username: ${_param:influxdb_user}
-      influxdb_password: ${_param:influxdb_password}
+      influxdb_database: lma
+      influxdb_username: lma
+      influxdb_password: ${_param:influxdb_stacklight_password}
       nagios_host: ${_param:nagios_host}
       nagios_username: ${_param:nagios_username}
       nagios_password: ${_param:nagios_password}
diff --git a/heka/remote_collector/cluster.yml b/heka/remote_collector/cluster.yml
index 7669bcf..ef7973f 100644
--- a/heka/remote_collector/cluster.yml
+++ b/heka/remote_collector/cluster.yml
@@ -6,9 +6,9 @@
     remote_collector:
       influxdb_host: ${_param:heka_influxdb_host}
       influxdb_port: ${_param:influxdb_port}
-      influxdb_database: ${_param:influxdb_database}
-      influxdb_username: ${_param:influxdb_user}
-      influxdb_password: ${_param:influxdb_password}
+      influxdb_database: lma
+      influxdb_username: lma
+      influxdb_password: ${_param:influxdb_stacklight_password}
       aggregator_host: ${_param:heka_aggregator_host}
       aggregator_port: ${_param:aggregator_port}
       elasticsearch_host: ${_param:heka_elasticsearch_host}
diff --git a/heka/remote_collector/single.yml b/heka/remote_collector/single.yml
index 7b4050e..c18484f 100644
--- a/heka/remote_collector/single.yml
+++ b/heka/remote_collector/single.yml
@@ -6,9 +6,9 @@
     remote_collector:
       influxdb_host: ${_param:heka_influxdb_host}
       influxdb_port: ${_param:influxdb_port}
-      influxdb_database: ${_param:influxdb_database}
-      influxdb_username: ${_param:influxdb_user}
-      influxdb_password: ${_param:influxdb_password}
+      influxdb_database: lma
+      influxdb_username: lma
+      influxdb_password: ${_param:influxdb_stacklight_password}
       aggregator_host: ${_param:heka_aggregator_host}
       aggregator_port: ${_param:aggregator_port}
       elasticsearch_host: ${_param:heka_elasticsearch_host}
diff --git a/influxdb/database/stacklight.yml b/influxdb/database/stacklight.yml
new file mode 100644
index 0000000..d741380
--- /dev/null
+++ b/influxdb/database/stacklight.yml
@@ -0,0 +1,23 @@
+parameters:
+  influxdb:
+    server:
+      database:
+        lma:
+          enabled: true
+          name: lma
+          retention_policy:
+          - name: lma
+            is_default: true
+            duration: 30d
+            replication: 1
+      user:
+        lma:
+          enabled: true
+          name: lma
+          password: ${_param:influxdb_stacklight_password}
+      grant:
+        grant_lma_all:
+          enabled: true
+          user: lma
+          database: lma
+          privilege: all
diff --git a/influxdb/server/single.yml b/influxdb/server/single.yml
index 3d40099..ed0b2d5 100644
--- a/influxdb/server/single.yml
+++ b/influxdb/server/single.yml
@@ -19,23 +19,3 @@
           enabled: true
           name: 'root'
           password: ${_param:influxdb_admin_password}
-      database:
-        lma:
-          enabled: true
-          name: lma
-          retention_policy:
-          - name: lma
-            is_default: true
-            duration: 30d
-            replication: 1
-      user:
-        lma:
-          enabled: true
-          name: lma
-          password: ${_param:influxdb_stacklight_password}
-      grant:
-        grant_lma_all:
-          enabled: true
-          user: lma
-          database: lma
-          privilege: all
diff --git a/reclass/storage/system/stacklight_server_cluster.yml b/reclass/storage/system/stacklight_server_cluster.yml
index 5a106b9..1ffe9b3 100644
--- a/reclass/storage/system/stacklight_server_cluster.yml
+++ b/reclass/storage/system/stacklight_server_cluster.yml
@@ -8,6 +8,7 @@
           classes:
           - cluster.${_param:cluster_name}.stacklight.server
           - system.influxdb.server.single
+          - system.influxdb.database.stacklight
           - system.elasticsearch.client.single
           - system.grafana.client.single
           - system.kibana.client.single