
Preliminary merge of git://github.com/ktc-itsnotbutter/pacemaker.git (in the chef/cookbooks/pacemaker/ directory) with the cookbook from the pacemaker_service branch of: https://github.com/mattray/barclamp_ha_service.git (in the chef/cookbooks/pacemaker2/ directory) since both forks had some nice stuff. This merge is not complete yet.
30 lines
786 B
Ruby
30 lines
786 B
Ruby
require 'base64'
|
|
|
|
# Install haveged to create entropy so keygen doesn't take an hour
|
|
%w{ corosync pacemaker }.each do |pkg|
|
|
package pkg
|
|
end
|
|
|
|
authkey = ""
|
|
|
|
# Find the master node:
|
|
if !File.exists?("/etc/corosync/authkey")
|
|
master = search(:node, "corosync:authkey")
|
|
if master.nil? or (master.length > 1)
|
|
Chef::Application.fatal! "You must have one node with the pacemaker::master recipe in their run list to be a client."
|
|
end
|
|
Chef::Log.info "Found pacemaker::master node: #{master[0].name}"
|
|
authkey = Base64.decode64(master[0]['corosync']['authkey'])
|
|
end
|
|
|
|
file "/etc/corosync/authkey" do
|
|
not_if {File.exists?("/etc/corosync/authkey")}
|
|
content authkey
|
|
owner "root"
|
|
mode "0400"
|
|
action :create
|
|
end
|
|
|
|
#manage the corosync services
|
|
include_recipe "pacemaker::default"
|