Initially populate things

This adds the basic framework for running germqtt somewhere. It's not
tested at all yet, but lays the groundwork of how this will work.
This commit is contained in:
Matthew Treinish 2016-07-19 18:08:41 -04:00
parent 237532f00e
commit 944a2ce800
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
6 changed files with 80 additions and 31 deletions

View File

@ -1,30 +0,0 @@
# == Class: germqtt::config
#
# This class is used to manage arbitrary germqtt configurations.
#
# === Parameters
#
# [*germqtt_config*]
# (optional) Allow configuration of arbitrary germqtt configurations.
# The value is an hash of germqtt_config resources. Example:
# { 'DEFAULT/foo' => { value => 'fooValue'},
# 'DEFAULT/bar' => { value => 'barValue'}
# }
# In yaml format, Example:
# germqtt_config:
# DEFAULT/foo:
# value: fooValue
# DEFAULT/bar:
# value: barValue
#
# NOTE: The configuration MUST NOT be already handled by this module
# or Puppet catalog compilation will fail with duplicate resources.
#
class germqtt::config (
$germqtt_config = {},
) {
validate_hash($germqtt_config)
create_resources('germqtt_config', $germqtt_config)
}

View File

@ -7,4 +7,10 @@
# [*sample_parameter*]
# Explanation of what this parameter affects and what it defaults to.
#
class germqtt {}
class germqtt {
package {'germqtt':
ensure => latest,
provider => 'pip',
require => Class['pip'],
}
}

53
manifests/server.pp Normal file
View File

@ -0,0 +1,53 @@
# 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.
# == Class: germqtt::server
#
class germqtt::server (
gerrit_username,
gerrit_hostname = review.openstack.org,
gerrit_key,
mqtt_hostname = firehose01.openstack.org,
topic = gerrit
) {
file { '/etc/germqtt.conf':
ensure => present,
owner => 'root',
group => 'root',
content => template('germqtt/germqtt.conf.erb')
}
file { '/etc/systemd/system/germqtt.service':
ensure => present,
owner => 'root',
group => 'root',
content => template('germqtt/germqtt.service.erb')
}
user { 'germqtt':
ensure => present,
system => true,
}
service { "germqtt":
enable => true,
hasrestart => true,
subscribe => [
File['/etc/germqtt/germqtt.conf'],
Package['germqtt'],
],
require => [
File['/etc/systemd/system/germqtt.service']
User['germqtt'],
],
}
}

Binary file not shown.

View File

@ -0,0 +1,8 @@
[gerrit]
username = <%= @gerrit_username %>
hostname = <%= @gerrit_hostname %>
key = <%= @gerrit_key %>
[mqtt]
hostname = <%= @mqtt_hostname %>
topic = <%= @topic %>

View File

@ -0,0 +1,12 @@
[Unit]
Description=Germqtt Daemon
[Service]
Type=forking
PIDFile=<%= @pid_file %>
ExecStart=/usr/local/bin/germqtt.py -c /etc/germqtt/germqtt.conf -p <%= @pid_file %>
User=germqtt
Group=germqtt
[Install]
WantedBy=multi-user.target