Skip to content

Commit

Permalink
Add Support for OpenBSD.
Browse files Browse the repository at this point in the history
  • Loading branch information
buzzdeee committed Feb 22, 2015
1 parent 2f955e1 commit ed99304
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/puppet/provider/rabbitmq_erlang_cookie/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ def exists?
def content=(value)
if resource[:force] == :true # Danger!
puppet('resource', 'service', resource[:service_name], 'ensure=stopped')
FileUtils.rm_rf('/var/lib/rabbitmq/mnesia')
FileUtils.rm_rf(resource[:rabbitmq_home] + File::PATH_SEPARATOR + 'mnesia')
File.open(resource[:path], 'w') do |cookie|
cookie.chmod(0400)
cookie.write(value)
end
FileUtils.chown('rabbitmq', 'rabbitmq', resource[:path])
FileUtils.chown(resource[:rabbitmq_user], resource[:rabbitmq_group], resource[:path])
else
fail("The current erlang cookie needs to change. In order to do this the RabbitMQ database needs to be wiped. Please set force => true to allow this to happen automatically.")
end
Expand Down
3 changes: 2 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
$management_port = $rabbitmq::management_port
$node_ip_address = $rabbitmq::node_ip_address
$plugin_dir = $rabbitmq::plugin_dir
$rabbitmq_home = $rabbitmq::rabbitmq_home
$port = $rabbitmq::port
$tcp_keepalive = $rabbitmq::tcp_keepalive
$service_name = $rabbitmq::service_name
Expand Down Expand Up @@ -100,7 +101,7 @@
if $erlang_cookie == undef {
fail('You must set the $erlang_cookie value in order to configure clustering.')
} else {
rabbitmq_erlang_cookie { '/var/lib/rabbitmq/.erlang.cookie':
rabbitmq_erlang_cookie { "${rabbitmq_home}/.erlang.cookie":
content => $erlang_cookie,
force => $wipe_db_on_cookie_change,
service_name => $service_name,
Expand Down
5 changes: 4 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
$repos_ensure = $rabbitmq::params::repos_ensure,
$manage_repos = $rabbitmq::params::manage_repos,
$plugin_dir = $rabbitmq::params::plugin_dir,
$rabbitmq_user = $rabbitmq::params::rabbitmq_user,
$rabbitmq_group = $rabbitmq::params::rabbitmq_group,
$rabbitmq_home = $rabbitmq::params::rabbitmq_home,
$port = $rabbitmq::params::port,
$tcp_keepalive = $rabbitmq::params::tcp_keepalive,
$service_ensure = $rabbitmq::params::service_ensure,
Expand Down Expand Up @@ -183,6 +186,7 @@
}

Class['::rabbitmq::service'] -> Class['::rabbitmq::install::rabbitmqadmin']
Class['::rabbitmq::install::rabbitmqadmin'] -> Rabbitmq_exchange<| |>
}

if $stomp_ensure {
Expand Down Expand Up @@ -212,6 +216,5 @@

# Make sure the various providers have their requirements in place.
Class['::rabbitmq::install'] -> Rabbitmq_plugin<| |>
Class['::rabbitmq::install::rabbitmqadmin'] -> Rabbitmq_exchange<| |>

}
6 changes: 3 additions & 3 deletions manifests/install/rabbitmqadmin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$protocol = $rabbitmq::ssl ? { false => 'http', default => 'https' }

staging::file { 'rabbitmqadmin':
target => '/var/lib/rabbitmq/rabbitmqadmin',
target => "${rabbitmq::rabbitmq_home}/rabbitmqadmin",
source => "${protocol}://${default_user}:${default_pass}@localhost:${management_port}/cli/rabbitmqadmin",
curl_option => '-k --noproxy localhost --retry 30 --retry-delay 6',
timeout => '180',
Expand All @@ -26,8 +26,8 @@

file { '/usr/local/bin/rabbitmqadmin':
owner => 'root',
group => 'root',
source => '/var/lib/rabbitmq/rabbitmqadmin',
group => '0',
source => "${rabbitmq::rabbitmq_home}/rabbitmqadmin",
mode => '0755',
require => Staging::File['rabbitmqadmin'],
}
Expand Down
27 changes: 26 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,53 @@
$package_name = 'rabbitmq'
$service_name = 'rabbitmq'
$version = '3.1.3-1'
$rabbitmq_user = 'rabbitmq'
$rabbitmq_group = 'rabbitmq'
$rabbitmq_home = '/var/lib/rabbitmq'
$plugin_dir = "/usr/lib/rabbitmq/lib/rabbitmq_server-${version}/plugins"
}
'Debian': {
$package_ensure = 'installed'
$package_name = 'rabbitmq-server'
$service_name = 'rabbitmq-server'
$package_provider = 'apt'
$version = '3.1.5'
$rabbitmq_user = 'rabbitmq'
$rabbitmq_group = 'rabbitmq'
$rabbitmq_home = '/var/lib/rabbitmq'
$plugin_dir = "/usr/lib/rabbitmq/lib/rabbitmq_server-${version}/plugins"
}
'OpenBSD': {
$package_ensure = 'installed'
$package_name = 'rabbitmq'
$service_name = 'rabbitmq'
$version = '3.4.2'
$rabbitmq_user = '_rabbitmq'
$rabbitmq_group = '_rabbitmq'
$rabbitmq_home = '/var/rabbitmq'
$plugin_dir = '/usr/local/lib/rabbitmq/plugins'
}
'RedHat': {
$package_ensure = 'installed'
$package_name = 'rabbitmq-server'
$service_name = 'rabbitmq-server'
$package_provider = 'rpm'
$version = '3.1.5-1'
$rabbitmq_user = 'rabbitmq'
$rabbitmq_group = 'rabbitmq'
$rabbitmq_home = '/var/lib/rabbitmq'
$plugin_dir = "/usr/lib/rabbitmq/lib/rabbitmq_server-${version}/plugins"
}
'SUSE': {
$package_ensure = 'installed'
$package_name = 'rabbitmq-server'
$service_name = 'rabbitmq-server'
$package_provider = 'zypper'
$version = '3.1.5-1'
$rabbitmq_user = 'rabbitmq'
$rabbitmq_group = 'rabbitmq'
$rabbitmq_home = '/var/lib/rabbitmq'
$plugin_dir = "/usr/lib/rabbitmq/lib/rabbitmq_server-${version}/plugins"
}
default: {
fail("The ${module_name} module is not supported on an ${::osfamily} based system.")
Expand Down Expand Up @@ -61,7 +87,6 @@
$erlang_cookie = undef
$interface = 'UNSET'
$node_ip_address = 'UNSET'
$plugin_dir = "/usr/lib/rabbitmq/lib/rabbitmq_server-${version}/plugins"
$port = '5672'
$tcp_keepalive = false
$ssl = false
Expand Down

0 comments on commit ed99304

Please sign in to comment.