# == Class: cluster:rabbitmq_fence # # Configures a rabbit-fence daemon for dead rabbitmq # nodes fencing. The daemon uses dbus # system events generated by the Corosync. # Requires corosync and rabbitmq packages installed # and corosync, rabbitmq services configured and running # # === Parameters # # [*enabled*] # (Optional) Ensures state for the rabbit-fence daemon. # Defaults to 'false' # class cluster::rabbitmq_fence( $enabled = false, ) { case $::osfamily { 'RedHat': { $packages = ['dbus', 'dbus-python', 'pygobject2', 'python-daemon' ] $dbus_service_name = 'messagebus' $service_name = 'rabbit-fence' } 'Debian': { $packages = [ 'python-gobject', 'python-gobject-2', 'python-dbus', 'python-daemon' ] $dbus_service_name = 'dbus' $service_name = 'fuel-rabbit-fence' } default: { fail("Unsupported osfamily: ${::osfamily} operatingsystem:\ ${::operatingsystem}, module ${module_name} only support osfamily\ RedHat and Debian") } } File { owner => 'root', group => 'root', } Service { hasstatus => true, hasrestart => true, } package { $packages: } -> service { $dbus_service_name: ensure => running, enable => true, } -> # This package brings all necessary packages for services. # So it is installed first. package { 'fuel-rabbit-fence': } -> service { 'corosync-notifyd': ensure => running, enable => true, } -> service { 'rabbit-fence': ensure => $enabled ? { true => running, false => stopped }, name => $service_name, enable => $enabled, require => Package['rabbitmq-server'], } Exec { path => [ '/bin', '/usr/bin' ], before => Service['corosync-notifyd'], require => Package['fuel-rabbit-fence'], } exec { 'enable_corosync_notifyd': command => 'sed -i s/START=no/START=yes/ /etc/default/corosync-notifyd', unless => 'grep START=yes /etc/default/corosync-notifyd', } #https://bugs.launchpad.net/ubuntu/+source/corosync/+bug/1437368 #FIXME(bogdando) remove these hacks after switched to systemd service.units exec { 'fix_corosync_notifyd_init_args': command => 'sed -i s/DAEMON_ARGS=\"\"/DAEMON_ARGS=\"-d\"/ /etc/init.d/corosync-notifyd', onlyif => 'grep \'DAEMON_ARGS=""\' /etc/init.d/corosync-notifyd', } #https://bugs.launchpad.net/ubuntu/+source/corosync/+bug/1437359 exec { 'fix_corosync_notifyd_init_pidfile': command => 'sed -i \'/PIDFILE=\/var\/run\/corosync.pid/d\' /etc/init.d/corosync-notifyd', onlyif => 'grep \'PIDFILE=/var/run/corosync.pid\' /etc/init.d/corosync-notifyd', } }