From a52f9845b97672888a2ceba7b0b11a593f0872f1 Mon Sep 17 00:00:00 2001 From: Stephen Gran Date: Sun, 12 Jan 2014 10:47:57 +0000 Subject: [PATCH] create users for debian.org hosts Signed-off-by: Stephen Gran --- modules/rabbitmq/manifests/autouser.pp | 21 +++++++++++++++++++++ modules/roles/manifests/pubsub/entities.pp | 4 ++++ 2 files changed, 25 insertions(+) create mode 100644 modules/rabbitmq/manifests/autouser.pp diff --git a/modules/rabbitmq/manifests/autouser.pp b/modules/rabbitmq/manifests/autouser.pp new file mode 100644 index 000000000..9e1462887 --- /dev/null +++ b/modules/rabbitmq/manifests/autouser.pp @@ -0,0 +1,21 @@ +# == Define: rabbitmq::autouser +# +# Create a user in rabbitmq automatically for debian.org hosts +# Should automatically create a password +# +# === Parameters +# +# === Examples +# +# rabbitmq::autouser { 'master.debian.org': } +# +define rabbitmq::autouser () { + + $rabbit_password = hkdf('/etc/puppet/secret', "mq-client-${name}") + + rabbitmq_user { $name: + admin => false, + password => $rabbit_password, + provider => 'rabbitmqctl', + } +} diff --git a/modules/roles/manifests/pubsub/entities.pp b/modules/roles/manifests/pubsub/entities.pp index 3f2d3c936..9ce30f49c 100644 --- a/modules/roles/manifests/pubsub/entities.pp +++ b/modules/roles/manifests/pubsub/entities.pp @@ -66,6 +66,10 @@ class roles::pubsub::entities { provider => 'rabbitmqctl', } + do_hosts = keys($site::localinfo) + + rabbitmq::autouser { do_hosts: } + rabbitmq_vhost { 'packages': ensure => present, provider => 'rabbitmqctl', -- 2.20.1