change attributes order and add corosync restart notification

This commit is contained in:
Robert 2013-04-20 15:37:36 +09:00
parent 3c11b43c5f
commit 2d5708d753
4 changed files with 42 additions and 16 deletions

View File

@ -1,6 +1,15 @@
# Only use short hostname (not FQDN)
default['pacemaker']['nodes'] = ['node1', 'node2']
# Stonith resources should be configured first!
default['pacemaker']['primitive']['st-node1']['agent'] = "stonith:null"
default['pacemaker']['primitive']['st-node1']['params']['hostlist'] = "#{pacemaker['nodes'][0]}"
default['pacemaker']['primitive']['st-node1']['active'] = ["#{pacemaker['nodes'][1]}"]
default['pacemaker']['primitive']['st-node2']['agent'] = "stonith:null"
default['pacemaker']['primitive']['st-node2']['params']['hostlist'] = "#{pacemaker['nodes'][1]}"
default['pacemaker']['primitive']['st-node2']['active'] = ["#{pacemaker['nodes'][0]}"]
default['pacemaker']['primitive']['drbd']['agent'] = "ocf:linbit:drbd"
default['pacemaker']['primitive']['drbd']['params']['drbd_resource'] = "r0"
default['pacemaker']['primitive']['drbd']['op']['monitor']['interval'] = "5s"
@ -28,14 +37,6 @@ default['pacemaker']['primitive']['vip']['op']['monitor']['nic'] = "eth0"
default['pacemaker']['primitive']['vip']['meta']['target-role'] = "Started"
default['pacemaker']['primitive']['vip']['active'] = "#{pacemaker['nodes']}"
default['pacemaker']['primitive']['st-node1']['agent'] = "stonith:null"
default['pacemaker']['primitive']['st-node1']['params']['hostlist'] = "#{pacemaker['nodes'][0]}"
default['pacemaker']['primitive']['st-node1']['active'] = ["#{pacemaker['nodes'][1]}"]
default['pacemaker']['primitive']['st-node2']['agent'] = "stonith:null"
default['pacemaker']['primitive']['st-node2']['params']['hostlist'] = "#{pacemaker['nodes'][1]}"
default['pacemaker']['primitive']['st-node2']['active'] = ["#{pacemaker['nodes'][0]}"]
default['pacemaker']['location']['l-st-node1']['rsc_name'] = "st-node1"
default['pacemaker']['location']['l-st-node1']['priority'] = "-inf"
default['pacemaker']['location']['l-st-node1']['loc'] = "#{pacemaker['nodes'][0]}"

View File

@ -18,7 +18,7 @@
# limitations under the License.
#
include_recipe "pacemaker::default"
include_recipe "pacemaker::setup"
directory "/usr/lib/ocf/resource.d/openstack" do
owner "root"

View File

@ -18,10 +18,4 @@
# limitations under the License.
#
package "pacemaker" do
action :install
end
service "pacemaker" do
action [:enable, :start]
end
include_recipe "pacemaker::config"

31
recipes/setup.rb Normal file
View File

@ -0,0 +1,31 @@
#
# Author:: Robert Choi
# Cookbook Name:: pacemaker
# Recipe:: setup
#
# Copyright 2013, Robert Choi
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package "pacemaker" do
action :install
notifies :restart, "service[corosync]", :immediately
end
execute "sleep 2"
service "pacemaker" do
action [ :enable, :start ]
notifies :restart, "service[clvm]", :immediately
end