Skip to content

Instantly share code, notes, and snippets.

@kcollasarundell
Created January 25, 2012 03:20
Show Gist options
  • Save kcollasarundell/1674529 to your computer and use it in GitHub Desktop.
Save kcollasarundell/1674529 to your computer and use it in GitHub Desktop.
class drbd::drbd_config {
# 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'] }
}
$data = inline_template("
<% drbd_resource.each do |res,resdata| -%>
resource <%= res -%> {
device <%= resdata[1] -%>;
disk /dev/vg_shared/drbd_<%= res -%>;
meta-disk internal;
syncer { rate 1000M; }
net {
allow-two-primaries;
after-sb-0pri discard-zero-changes;
after-sb-1pri discard-secondary;
after-sb-2pri disconnect;
}
startup { become-primary-on both; }
on <%= fqdn %> {
<% resdata.each do |nodedata| -%>
address <%= nodedata[1][0] %>:7789;
<% end -%>
}
}
<% end -%>
")
notify{$data: }
}
include drbd::drbd_config
resource data_share1 {
device ;
disk /dev/vg_shared/drbd_data_share1;
meta-disk internal;
syncer { rate 1000M; }
net {
allow-two-primaries;
after-sb-0pri discard-zero-changes;
after-sb-1pri discard-secondary;
after-sb-2pri disconnect;
}
startup { become-primary-on both; }
on fqdn {
address 192.168.222.22:7789
address 192.168.222.21:7789
}
}
resource data_share2 {
device ;
disk /dev/vg_shared/drbd_data_share2;
meta-disk internal;
syncer { rate 1000M; }
net {
allow-two-primaries;
after-sb-0pri discard-zero-changes;
after-sb-1pri discard-secondary;
after-sb-2pri disconnect;
}
startup { become-primary-on both; }
on fqdn {
address 192.168.222.22:7789
address 192.168.222.21:7789
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment