add pubsub::autouser
authorMartin Zobel-Helas <zobel@debian.org>
Sun, 31 May 2015 19:38:41 +0000 (19:38 +0000)
committerMartin Zobel-Helas <zobel@debian.org>
Sun, 31 May 2015 19:38:41 +0000 (19:38 +0000)
Signed-off-by: Martin Zobel-Helas <zobel@debian.org>
modules/pubsub/manifest/autouser.pp [new file with mode: 0644]

diff --git a/modules/pubsub/manifest/autouser.pp b/modules/pubsub/manifest/autouser.pp
new file mode 100644 (file)
index 0000000..2a27cda
--- /dev/null
@@ -0,0 +1,27 @@
+# == Define: pubsub::autouser
+#
+# Create a user in rabbitmq automatically for debian.org hosts
+# Should automatically create a password
+#
+# === Parameters
+#
+# === Examples
+#
+#  pubsub::autouser { 'master.debian.org': }
+#
+define pubsub::autouser () {
+
+       $pubsub_password = hkdf('/etc/puppet/secret', "mq-client-${name}")
+
+       rabbitmq_user { $name:
+               admin    => false,
+               password => $pubsub_password,
+       }
+
+       rabbitmq_user_permissions { "${name}@dsa":
+               configure_permission => '.*',
+               read_permission      => '.*',
+               write_permission     => '.*',
+       }
+}
+