From 1e685b4fad5fbee6b829efdec1fbf1d71c2d0593 Mon Sep 17 00:00:00 2001 From: Sebastian Reitenbach Date: Sun, 22 Feb 2015 15:38:04 +0100 Subject: [PATCH] Add rabbitmq_home, rabbitmq_user and rabbitmq_group to rabbitmq_erlang_cookie And pass them in config.pp when it is used. Document the rabbitmq_home, rabbitmq_user and rabbitmq_group parameters in README.md --- README.md | 16 ++++++++++++++-- lib/puppet/type/rabbitmq_erlang_cookie.rb | 12 ++++++++++++ manifests/config.pp | 15 ++++++++++----- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 258f9bf13..781061d4e 100644 --- a/README.md +++ b/README.md @@ -381,6 +381,18 @@ repository otherwise. Boolean to determine if we should DESTROY AND DELETE the RabbitMQ database. +####`rabbitmq_user` + +String: OS dependent, default defined in param.pp. The system user the rabbitmq daemon runs as. + +####`rabbitmq_group` + +String: OS dependent, default defined in param.pp. The system group the rabbitmq daemon runs as. + +####`rabbitmq_home` + +String: OS dependent. default defined in param.pp. The home directory of the rabbitmq deamon. + ##Native Types ### rabbitmq\_user @@ -493,9 +505,9 @@ rabbitmq_plugin {'rabbitmq_stomp': This is essentially a private type used by the rabbitmq::config class to manage the erlang cookie. It replaces the rabbitmq_erlang_cookie fact from earlier versions of this module. It manages the content of the cookie -usually located at /var/lib/rabbitmq/.erlang.cookie, which includes +usually located at "${rabbitmq_home}/.erlang.cookie", which includes stopping the rabbitmq service and wiping out the database at -/var/lib/rabbitmq/mnesia if the user agrees to it. We don't recommend using +"${rabbitmq_home}/mnesia" if the user agrees to it. We don't recommend using this type directly. ##Limitations diff --git a/lib/puppet/type/rabbitmq_erlang_cookie.rb b/lib/puppet/type/rabbitmq_erlang_cookie.rb index 564af5253..c2e5898dc 100644 --- a/lib/puppet/type/rabbitmq_erlang_cookie.rb +++ b/lib/puppet/type/rabbitmq_erlang_cookie.rb @@ -16,6 +16,18 @@ def change_to_s(current, desired) newvalues(:true, :false) end + newparam(:rabbitmq_user) do + defaultto('rabbitmq') + end + + newparam(:rabbitmq_group) do + defaultto('rabbitmq') + end + + newparam(:rabbitmq_home) do + defaultto('/var/lib/rabbitmq') + end + newparam(:service_name) do newvalues(/^\S+$/) end diff --git a/manifests/config.pp b/manifests/config.pp index e83bda986..be7169d38 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -18,6 +18,8 @@ $management_port = $rabbitmq::management_port $node_ip_address = $rabbitmq::node_ip_address $plugin_dir = $rabbitmq::plugin_dir + $rabbitmq_user = $rabbitmq::rabbitmq_user + $rabbitmq_group = $rabbitmq::rabbitmq_group $rabbitmq_home = $rabbitmq::rabbitmq_home $port = $rabbitmq::port $tcp_keepalive = $rabbitmq::tcp_keepalive @@ -102,11 +104,14 @@ fail('You must set the $erlang_cookie value in order to configure clustering.') } else { rabbitmq_erlang_cookie { "${rabbitmq_home}/.erlang.cookie": - content => $erlang_cookie, - force => $wipe_db_on_cookie_change, - service_name => $service_name, - before => File['rabbitmq.config'], - notify => Class['rabbitmq::service'], + content => $erlang_cookie, + force => $wipe_db_on_cookie_change, + rabbitmq_user => $rabbitmq_user, + rabbitmq_group => $rabbitmq_group, + rabbitmq_home => $rabbitmq_home, + service_name => $service_name, + before => File['rabbitmq.config'], + notify => Class['rabbitmq::service'], } } }