+# = Class: roles::dbmaster
+#
+# Setup for db.debian.org master host
+#
+# == Sample Usage:
+#
+# include roles::dbmaster
+#
class roles::dbmaster {
+
+ include roles::pubsub::params
+
+ $rabbit_password = $roles::pubsub::params::rabbit_password
+
ssl::service { 'db.debian.org':
notify => Service['apache2'],
}
+
+ roles::pubsub::config { 'generate':
+ key => 'dsa-udgenerate',
+ exchange => dsa,
+ topic => 'dsa.ud.replicate',
+ vhost => dsa,
+ username => $::fqdn,
+ password => $rabbit_password
+ }
}
#
class roles::pubsub::client {
- $rabbit_password = hkdf('/etc/puppet/secret', "mq-client-${::fqdn}")
+ include roles::pubsub::params
- file { '/etc/dsa/pubsub.conf':
- content => template('roles/pubsub/pubsub.conf.erb'),
- mode => '0440'
- }
+ $rabbit_password = $roles::pubsub::params::rabbit_password
package { 'python-dsa-mq':
ensure => latest,
tag => extra_repo,
}
+
+ roles::pubsub::config { 'homedirs':
+ key => 'dsa-homedirs',
+ exchange => dsa,
+ topic => 'dsa.git.homedirs',
+ vhost => dsa,
+ username => $::fqdn,
+ password => $rabbit_password
+ }
+
+ roles::pubsub::config { 'replicate':
+ key => 'dsa-udreplicate',
+ exchange => dsa,
+ queue => "ud-${::fqdn}",
+ topic => 'dsa.ud.replicate',
+ vhost => dsa,
+ username => $::fqdn,
+ password => $rabbit_password
+ }
}
--- /dev/null
+# = Define: roles::pubsub::config
+#
+# Connection stanzas for pubsub clients
+#
+# === Parameters
+#
+# [*key*]
+# The lookup key for the ini file, ie:
+# [foo] <- this
+# a=b
+#
+# [*topic*]
+# The topic to send or receive on
+#
+# [*username*]
+# Authentication username for the connection
+# Defaults to $::fqdn
+#
+# [*password*]
+# Authentication password for the connection
+#
+# [*vhost*]
+# RabbitMQ vhost to use for the connection
+# Defaults to 'dsa'
+#
+# [*exchange*]
+# RabbitMQ exchange to use for the connection
+# Defaults to 'dsa'
+#
+# [*queue*]
+# RabbitMQ queue to use for the connection
+# Only necessary on connections where client is receiving messages
+#
+# [*order*]
+# Ordering hint for concat
+# Defaults to '00'
+#
+# == Sample Usage:
+#
+# roles::pubsub::config { 'testme':
+# key => 'test',
+# exchange => dsa,
+# topic => 'dsa.git.test',
+# vhost => dsa,
+# username => $::fqdn,
+# password => 1234,
+# order => 00
+# }
+#
+define roles::pubsub::config (
+ $key,
+ $topic,
+ $password,
+ $vhost=dsa,
+ $exchange=dsa,
+ $username=$::fqdn,
+ $queue=undef,
+ $order=00
+){
+ include roles::pubsub::config::setup
+
+ concat::fragment { "pubsub_conf_${name}":
+ target => '/etc/dsa/pubsub.conf',
+ source => 'puppet:///modules/roles/pubsub/pubsub.conf.erb',
+ order => $order,
+ }
+}
--- /dev/null
+# = Class: roles::pubsub::config::setup
+#
+# Sets up concat fragments for pubsub config stanzas
+#
+# == Sample Usage:
+#
+# include roles::pubsub::config::setup
+#
+class roles::pubsub::config::setup {
+ include concat::setup
+
+ concat { '/etc/dsa/pubsub.conf':
+ owner => root,
+ group => root,
+ mode => '0440',
+ }
+}
-[dsa-homedirs]
-vhost=dsa
-topic=dsa.git.homedirs
-exchange=dsa
-username=<%= @fqdn %>
-password=<%= @rabbit_password %>
+[<%= @key -%>]
+vhost=<%= @vhost %>
+topic=<%= @topic %>
+exchange=<%= @exchange %
+username=<%= @username %>
+password=<%= @password %>
+<% if @queue -%>
+queue=<%= @queue %>
+<% end -%>
-[dsa-udreplicate]
-vhost=dsa
-topic=dsa.ud.replicate
-exchange=dsa
-username=<%= @fqdn %>
-password=<%= @rabbit_password %>
-queue=ud-<%= @fqdn %>