Deploy InfluxDB for Prometheus remote storage

This change deploys the InfluxDB service on the mon nodes of
virtual-mcp11-{dvr,contrail,k8s-calico,k8s-contrail}. InfluxDB will be
used by Prometheus for long-term storage.

Change-Id: Ibfb2dd08e539dbd0bb73ef03713f5f0d77d7da40
diff --git a/classes/cluster/virtual-mcp11-contrail/stacklight/server.yml b/classes/cluster/virtual-mcp11-contrail/stacklight/server.yml
index 50c5b6e..28ac052 100755
--- a/classes/cluster/virtual-mcp11-contrail/stacklight/server.yml
+++ b/classes/cluster/virtual-mcp11-contrail/stacklight/server.yml
@@ -1,6 +1,7 @@
 classes:
 - system.docker.host
 - system.linux.system.repo.glusterfs
+- system.linux.system.repo.influxdb
 - system.linux.system.repo.mcp.salt
 - system.linux.system.repo.tcp_elastic
 - system.heka.remote_collector
@@ -13,7 +14,10 @@
 - system.kibana.server.single
 - system.haproxy.proxy.listen.stacklight.elasticsearch
 - system.haproxy.proxy.listen.stacklight.kibana
+- system.haproxy.proxy.listen.stacklight.influxdb
 - service.haproxy.proxy.single
+- system.influxdb.server.single
+- system.influxdb.database.stacklight
 - system.keepalived.cluster.instance.prometheus_server_vip
 - system.telegraf.agent.remote
 - system.prometheus.server.alertmanager.dns
@@ -47,6 +51,9 @@
     glusterfs_node01_address: ${_param:openstack_control_node01_address}
     glusterfs_node02_address: ${_param:openstack_control_node02_address}
     glusterfs_node03_address: ${_param:openstack_control_node03_address}
+    influxdb_port: 8086
+    influxdb_admin_password: password
+    influxdb_stacklight_password: lmapass
   linux:
     network:
       interface:
diff --git a/classes/cluster/virtual-mcp11-dvr/stacklight/server.yml b/classes/cluster/virtual-mcp11-dvr/stacklight/server.yml
index 84923ac..f0f082d 100644
--- a/classes/cluster/virtual-mcp11-dvr/stacklight/server.yml
+++ b/classes/cluster/virtual-mcp11-dvr/stacklight/server.yml
@@ -1,6 +1,7 @@
 classes:
 - system.docker.host
 - system.linux.system.repo.glusterfs
+- system.linux.system.repo.influxdb
 - system.linux.system.repo.mcp.salt
 - system.linux.system.repo.tcp_elastic
 - system.heka.remote_collector
@@ -13,7 +14,10 @@
 - system.kibana.server.single
 - system.haproxy.proxy.listen.stacklight.elasticsearch
 - system.haproxy.proxy.listen.stacklight.kibana
+- system.haproxy.proxy.listen.stacklight.influxdb
 - service.haproxy.proxy.single
+- system.influxdb.server.single
+- system.influxdb.database.stacklight
 - system.keepalived.cluster.instance.prometheus_server_vip
 - system.telegraf.agent.remote
 - system.prometheus.server.alertmanager.dns
@@ -47,6 +51,9 @@
     glusterfs_node01_address: ${_param:openstack_control_node01_address}
     glusterfs_node02_address: ${_param:openstack_control_node02_address}
     glusterfs_node03_address: ${_param:openstack_control_node03_address}
+    influxdb_port: 8086
+    influxdb_admin_password: password
+    influxdb_stacklight_password: lmapass
   linux:
     network:
       interface:
diff --git a/classes/cluster/virtual-mcp11-k8s-calico/stacklight/server.yml b/classes/cluster/virtual-mcp11-k8s-calico/stacklight/server.yml
index ecbaa80..ef47ea4 100644
--- a/classes/cluster/virtual-mcp11-k8s-calico/stacklight/server.yml
+++ b/classes/cluster/virtual-mcp11-k8s-calico/stacklight/server.yml
@@ -1,5 +1,6 @@
 classes:
 - system.docker.host
+- system.linux.system.repo.influxdb
 - system.linux.system.repo.tcp_elastic
 # Needed to install Galera packages
 - system.linux.system.repo.mcp.openstack
@@ -8,6 +9,7 @@
 - system.kibana.server.single
 - system.haproxy.proxy.listen.stacklight.elasticsearch
 - system.haproxy.proxy.listen.stacklight.kibana
+- system.haproxy.proxy.listen.stacklight.influxdb
 - service.haproxy.proxy.single
 - system.glusterfs.client.cluster
 - system.glusterfs.client.volume.prometheus
@@ -15,6 +17,8 @@
 - system.glusterfs.server.volume.prometheus
 - system.galera.server.cluster
 - system.galera.server.database.grafana
+- system.influxdb.server.single
+- system.influxdb.database.stacklight
 - system.salt.minion.cert.prometheus_server
 - system.keepalived.cluster.instance.prometheus_server_vip
 - system.telegraf.agent.remote
@@ -55,6 +59,9 @@
     grafana_database_host: ${_param:cluster_vip_address}
     grafana_database_password: ${_param:mysql_grafana_password}
     grafana_database_type: mysql
+    influxdb_port: 8086
+    influxdb_admin_password: password
+    influxdb_stacklight_password: lmapass
   keepalived:
     cluster:
       instance:
diff --git a/classes/cluster/virtual-mcp11-k8s-contrail/stacklight/server.yml b/classes/cluster/virtual-mcp11-k8s-contrail/stacklight/server.yml
index d073ec1..ac90c31 100644
--- a/classes/cluster/virtual-mcp11-k8s-contrail/stacklight/server.yml
+++ b/classes/cluster/virtual-mcp11-k8s-contrail/stacklight/server.yml
@@ -1,4 +1,5 @@
 classes:
+- system.linux.system.repo.influxdb
 - system.linux.system.repo.tcp_elastic
 - system.docker.host
 - system.elasticsearch.server.cluster
@@ -6,11 +7,14 @@
 - system.kibana.server.single
 - system.haproxy.proxy.listen.stacklight.elasticsearch
 - system.haproxy.proxy.listen.stacklight.kibana
+- system.haproxy.proxy.listen.stacklight.influxdb
 - service.haproxy.proxy.single
 - system.glusterfs.client.cluster
 - system.glusterfs.client.volume.prometheus
 - system.glusterfs.server.cluster
 - system.glusterfs.server.volume.prometheus
+- system.influxdb.server.single
+- system.influxdb.database.stacklight
 - system.salt.minion.cert.prometheus_server
 - system.keepalived.cluster.instance.prometheus_server_vip
 - system.telegraf.agent.remote
@@ -43,3 +47,6 @@
     cluster_node02_address: ${_param:stacklight_node02_address}
     cluster_node03_hostname: ${_param:stacklight_node03_hostname}
     cluster_node03_address: ${_param:stacklight_node03_address}
+    influxdb_port: 8086
+    influxdb_admin_password: password
+    influxdb_stacklight_password: lmapass
diff --git a/scripts/stacklightv2_infra_install.sh b/scripts/stacklightv2_infra_install.sh
index 5794978..79b9881 100755
--- a/scripts/stacklightv2_infra_install.sh
+++ b/scripts/stacklightv2_infra_install.sh
@@ -11,6 +11,8 @@
 fi
 . "$COMMONS"
 
+INFLUXDB_SERVICE=$(salt -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true)
+
 # Configure Telegraf
 salt -C 'I@telegraf:agent' state.sls telegraf
 
@@ -23,6 +25,10 @@
 salt -C 'I@elasticsearch:client' state.sls elasticsearch.client
 salt -C 'I@kibana:client' state.sls kibana.client
 
+if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
+    salt -C 'I@influxdb:server' state.sls influxdb
+fi
+
 # Collect grains needed to configure the services
 salt -C 'I@salt:minion' state.sls salt.minion.grains
 salt -C 'I@salt:minion' saltutil.refresh_modules