Created
January 25, 2012 03:54
-
-
Save kcollasarundell/1674614 to your computer and use it in GitHub Desktop.
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
#!/bin/ruby | |
# require Class[drbd::drbd_install] | |
# require Class[drbd::drbd_service] | |
# $drbd_resource = ymllookup('drbd_resource') | |
drbd_resource = { "data_share1" => { 'node1.local' => ['192.168.222.21','/dev/drbd1'], | |
'node2.local' => ['192.168.222.22','/dev/drbd1'] }, | |
"data_share2" => { 'node1.local' => ['192.168.222.21','/dev/drbd2'], | |
'node2.local' => ['192.168.222.22','/dev/drbd2'] }} | |
#drbd_resource.each do |res,resdata| | |
# puts "resource #{res}" | |
# resdata.each do |nodedata| | |
# puts "device #{nodedata[1][1]}" | |
# puts "disk /dev/vg_shared/drbd_#{res}" | |
# puts "fqdn" | |
# puts "#{nodedata[1][0]}:7789" | |
# end | |
#end | |
drbd_resource.each do |res,resdata| | |
puts "resource #{res} {" | |
resdata.each do |fqdn,nodeinfo| | |
if fqdn == "node1.local" | |
puts fqdn | |
puts " device #{nodeinfo[1]};" | |
end | |
end | |
puts " disk /dev/vg_shared/drbd_#{res};" | |
puts " meta-disk internal;" | |
puts " syncer { rate 1000M; }" | |
puts " net {" | |
puts " allow-two-primaries;" | |
puts " after-sb-0pri discard-zero-changes;" | |
puts " after-sb-1pri discard-secondary;" | |
puts " after-sb-2pri disconnect;" | |
puts " }" | |
puts " startup { become-primary-on both; }" | |
puts " on fqdn {" | |
resdata.each do |nodedata| | |
puts " address #{nodedata[1][0]}:7789" | |
end | |
puts " }" | |
puts "}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment