Created
August 3, 2009 23:14
-
-
Save macros/160880 to your computer and use it in GitHub Desktop.
Chef recipe for heartbeat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auth 1 | |
1 md5 <%= @node[:heartbeat][:secret] %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cookbook Name:: heartbeat | |
# Recipe:: default | |
# | |
# Copyright 2009, Wikia Inc | |
# | |
# 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 "heartbeat" | |
template "/etc/ha.d/ha.cf" do | |
mode 0644 | |
source "ha.cf.erb" | |
end | |
template "/etc/ha.d/authkeys" do | |
mode 0600 | |
source "authkeys.erb" | |
end | |
template "/etc/ha.d/haresources" do | |
mode 0644 | |
source "haresources.erb" | |
end | |
service "heartbeat" do | |
action [ :enable, :start ] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
logfacility local0 | |
keepalive 250ms | |
deadtime 2 | |
warntime 1 | |
initdead 15 | |
udpport <%= @node[:heartbeat][:port] %> | |
ucast <%= @node[:heartbeat][:interface] %> <%= @node[:heartbeat][:other_member] %> | |
auto_failback off | |
<% @node[:heartbeat][:nodes].each do |node| -%> | |
node <%= node %> | |
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= @node[:heartbeat][:haresources] %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cookbook Name:: heartbeat | |
# Attributes:: heartbeat | |
# | |
# Copyright 2008, Wikia, Inc. | |
# | |
# 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. | |
# | |
heartbeat Mash.new unless attribute?("heartbeat") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
maintainer "Wikia, Inc." | |
maintainer_email "[email protected]" | |
license "Apache 2.0" | |
description "Sets up a heartbeat cluster" | |
version "0.7" | |
%w{ ubuntu debian }.each do |os| | |
supports os | |
end | |
attribute "heartbeat", | |
:display_name => "Heartbeat Hash", | |
:description => "Hash of heartbeat attributes", | |
:type => "hash" | |
attribute "heartbeat/haresources", | |
:display_name => "Heartbeat resources", | |
:description => "The resources line for the cluster", | |
:default => '' | |
attribute "heartbeat/port", | |
:display_name => "Heartbeat port", | |
:description => "The heartbeat port", | |
:default => "694" | |
attribute "heartbeat/other_member", | |
:display_name => "Heartbeat cluster member", | |
:description => "The other member of the heartbeat cluster", | |
:default => '' | |
attribute "heartbeat/interface", | |
:display_name => "Heartbeat interface", | |
:description => "Interface that heartbeat listens on", | |
:default => "eth0" | |
attribute "heartbeat/nodes", | |
:display_name => "Heartbeat nodes", | |
:description => "Members of the heartbeat cluster", | |
:type => "array" | |
attribute "heartbeat/secret", | |
:display_name => "Heartbeat secret", | |
:description => "Shared cluster password", | |
:default => "changeme" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"heartbeat": { | |
"other_member": "192.168.0.5", | |
"port": "694", | |
"interface": "eth0", | |
"haresources": "lvs5 192.168.0.1/24 192.168.0.2/24", | |
"nodes": [ | |
"node1", | |
"node2" | |
], | |
"secret": "XXXXX" | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment