From 944a2ce800a0512899fa8c5e147c6a54b551f41c Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 19 Jul 2016 18:08:41 -0400 Subject: [PATCH] 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. --- manifests/config.pp | 30 ------------------ manifests/init.pp | 8 ++++- manifests/server.pp | 53 ++++++++++++++++++++++++++++++++ templates/.germqtt.conf.erb.swp | Bin 0 -> 12288 bytes templates/germqtt.conf.erb | 8 +++++ templates/germqtt.service.erb | 12 ++++++++ 6 files changed, 80 insertions(+), 31 deletions(-) delete mode 100644 manifests/config.pp create mode 100644 manifests/server.pp create mode 100644 templates/.germqtt.conf.erb.swp create mode 100644 templates/germqtt.conf.erb create mode 100644 templates/germqtt.service.erb diff --git a/manifests/config.pp b/manifests/config.pp deleted file mode 100644 index be8bd5a..0000000 --- a/manifests/config.pp +++ /dev/null @@ -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) -} diff --git a/manifests/init.pp b/manifests/init.pp index 366e412..c7e6b50 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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'], + } +} diff --git a/manifests/server.pp b/manifests/server.pp new file mode 100644 index 0000000..215705b --- /dev/null +++ b/manifests/server.pp @@ -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'], + ], + } +} diff --git a/templates/.germqtt.conf.erb.swp b/templates/.germqtt.conf.erb.swp new file mode 100644 index 0000000000000000000000000000000000000000..00191ef554a91a9497dba8685dbc19328ec56dd8 GIT binary patch literal 12288 zcmeI&y-LJD5C`x%D;rU?7IMm!Cg%qT;)$(=rHaULVyB(Y;EP!K z48DS3<*c_kqFi;@1pa|xv$K=Q=GTR!-#$J#^tSyil4F7B>*e93x%1|IL_|@R=z^7D zqlU`Zg2_i7r(t?kOkS*H?|wH71~CV^&|2}@K$+x*IbfCO>yT9*xQriV>4mRMztRV% z5P-lm0&}#vvEH^8+0#wpK<%2bz|et z=%yGT009U<00Izz00bZa0SG_<0uZR7KzL5HJWq5gVZZ;E@Bg1Nf0uZbc$RpQc$CN_ zerjv@tk^OHAOHafKmY;|fB*y_009U<;NJx}({bc=yxmsE+aFC@dvuxQoQ8=i7wk{( sy>U_s&TOVjG*q``jr<93V(!_@gbr@C+M~#osounujMMfuqg +hostname = <%= @gerrit_hostname %> +key = <%= @gerrit_key %> + +[mqtt] +hostname = <%= @mqtt_hostname %> +topic = <%= @topic %> diff --git a/templates/germqtt.service.erb b/templates/germqtt.service.erb new file mode 100644 index 0000000..b7486c4 --- /dev/null +++ b/templates/germqtt.service.erb @@ -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