From 0d5de2e02cbeffcf03559a20a75e40b7dc83963c Mon Sep 17 00:00:00 2001
From: Matthew Treinish <mtreinish@kortar.org>
Date: Tue, 26 Jul 2016 19:03:55 -0400
Subject: [PATCH] Add firehose.o.o config to system-config

This commit adds the policy to configure firehose nodes which will run
mosquitto and a germqtt daemon.

Depends-On: Ibec91fd0abc637ea7087872cab1ec8487c73acae
Depends-On: I24a0cdb6a41f6e440db8e68216b19ca61b4cba31
Change-Id: Ie3be71e16c42c32a9f479da468db6c53ebae52ac
---
 manifests/site.pp                             | 14 +++++++
 modules.env                                   |  2 +
 .../openstack_project/manifests/firehose.pp   | 42 +++++++++++++++++++
 3 files changed, 58 insertions(+)
 create mode 100644 modules/openstack_project/manifests/firehose.pp

diff --git a/manifests/site.pp b/manifests/site.pp
index 1a46d5c7c0..07e445790c 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -462,6 +462,20 @@ node /^elasticsearch0[1-7]\.openstack\.org$/ {
   }
 }
 
+# Node-OS: xenial
+node /^firehose\d+\.openstack\.org$/ {
+  class { 'openstack_project::server':
+    iptables_public_tcp_ports => [22, 80, 1883],
+    sysadmins                 => hiera('sysadmins', []),
+  }
+  class { 'openstack_project::firehose':
+    gerrit_ssh_host_key => hiera('gerrit_ssh_rsa_pubkey_contents'),
+    gerrit_public_key   => hiera('germqtt_gerrit_ssh_private_key'),
+    gerrit_private_key  => hiera('germqtt_gerrit_ssh_private_key'),
+    mqtt_password       => hiera('mqtt_service_user_password'),
+  }
+}
+
 # CentOS machines to load balance git access.
 # Node-OS: centos7
 node /^git(-fe\d+)?\.openstack\.org$/ {
diff --git a/modules.env b/modules.env
index ae7e5fce6e..bfc5bc7945 100644
--- a/modules.env
+++ b/modules.env
@@ -102,6 +102,7 @@ INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-elastic_recheck"
 INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-elasticsearch"]="origin/master"
 INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-etherpad_lite"]="origin/master"
 INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-exim"]="origin/master"
+INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-germqtt"]="origin/master"
 INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-gerrit"]="origin/master"
 INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-gerritbot"]="origin/master"
 INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-github"]="origin/master"
@@ -123,6 +124,7 @@ INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-logstash"]="orig
 INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-mailman"]="origin/master"
 INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-mediawiki"]="origin/master"
 INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-meetbot"]="origin/master"
+INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-mosquitto"]="origin/master"
 INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-mysql_backup"]="origin/master"
 INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-nodepool"]="origin/master"
 INTEGRATION_MODULES["$OPENSTACK_GIT_ROOT/openstack-infra/puppet-odsreg"]="origin/master"
diff --git a/modules/openstack_project/manifests/firehose.pp b/modules/openstack_project/manifests/firehose.pp
new file mode 100644
index 0000000000..602c2e5ff8
--- /dev/null
+++ b/modules/openstack_project/manifests/firehose.pp
@@ -0,0 +1,42 @@
+# Copyright 2016 Hewlett-Packard Development Company, L.P.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# firehose glue class.
+#
+class openstack_project::firehose (
+  $gerrit_username = 'germqtt',
+  $gerrit_public_key,
+  $gerrit_private_key,
+  $gerrit_ssh_host_key,
+  $mqtt_hostname = 'firehose01.openstack.org',
+  $mqtt_password,
+  $mqtt_username = 'infra',
+) {
+  include mosquitto
+  class {'mosquitto::server':
+    log_file               => '/var/log/mosquitto.log',
+    infra_service_username => $mqtt_username,
+    infra_service_password => $mqtt_password,
+  }
+
+  include germqtt
+  class {'germqtt::server':
+    gerrit_username     => $gerrit_username,
+    gerrit_public_key   => $gerrit_public_key,
+    gerrit_private_key  => $gerrit_private_key,
+    gerrit_ssh_host_key => $gerrit_ssh_host_key,
+    mqtt_username       => $mqtt_username,
+    mqtt_password       => $mqtt_password,
+  }
+}