
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.
44 lines
996 B
Ruby
44 lines
996 B
Ruby
require 'base64'
|
|
|
|
# Install haveged to create entropy so keygen doesn't take an hour
|
|
# odd errors coming out of automated installation, gets restarted next
|
|
package "haveged" do
|
|
ignore_failure true
|
|
end
|
|
|
|
%w{ corosync pacemaker }.each do |pkg|
|
|
package pkg
|
|
end
|
|
|
|
service "haveged" do
|
|
supports :restart => true, :status => :true
|
|
action [:enable, :start]
|
|
end
|
|
|
|
#create authkey
|
|
execute "corosync-keygen" do
|
|
creates "/etc/corosync/authkey"
|
|
user "root"
|
|
umask "0400"
|
|
action :run
|
|
end
|
|
|
|
# Read authkey (it's binary) into encoded format and save to chef server
|
|
ruby_block "Store authkey" do
|
|
block do
|
|
file = File.new('/etc/corosync/authkey', 'r')
|
|
contents = ""
|
|
file.each do |f|
|
|
contents << f
|
|
end
|
|
packed = Base64.encode64(contents)
|
|
node.set_unless['corosync']['authkey'] = packed
|
|
node.save
|
|
end
|
|
action :nothing
|
|
subscribes :create, resources(:execute => "corosync-keygen"), :immediately
|
|
end
|
|
|
|
#manage the corosync services
|
|
include_recipe "pacemaker::default"
|