diff --git a/manifests/resource.pp b/manifests/resource.pp index e65b322..6bd50e2 100644 --- a/manifests/resource.pp +++ b/manifests/resource.pp @@ -23,32 +23,34 @@ # [ha_primary] If the resource is being applied on the primary host. # [initial_setup] If this run is associated with the initial setup. Allows a user # to only perform dangerous setup on the initial run. +# [startup_parameters] Manage startup{} parameters (like wfc-timeout) define drbd::resource ( - $host1 = undef, - $host2 = undef, - $ip1 = undef, - $ip2 = undef, - $res1 = undef, - $res2 = undef, - $cluster = undef, - $secret = false, - $port = '7789', - $device = '/dev/drbd0', - $mountpoint = "/drbd/${name}", - $automount = true, - $owner = 'root', - $group = 'root', - $protocol = 'C', - $verify_alg = 'crc32c', - $rate = false, - $disk_parameters = false, - $net_parameters = false, - $manage = true, - $ha_primary = false, - $initial_setup = false, - $fs_type = 'ext4', - $mkfs_opts = '', - $disk = undef, + $host1 = undef, + $host2 = undef, + $ip1 = undef, + $ip2 = undef, + $res1 = undef, + $res2 = undef, + $cluster = undef, + $secret = false, + $port = '7789', + $device = '/dev/drbd0', + $mountpoint = "/drbd/${name}", + $automount = true, + $owner = 'root', + $group = 'root', + $protocol = 'C', + $verify_alg = 'crc32c', + $rate = false, + $disk_parameters = false, + $net_parameters = false, + $manage = true, + $ha_primary = false, + $initial_setup = false, + $fs_type = 'ext4', + $mkfs_opts = '', + $disk = undef, + $startup_parameters = undef, ) { include ::drbd diff --git a/manifests/resource/up.pp b/manifests/resource/up.pp index 7668792..8047907 100644 --- a/manifests/resource/up.pp +++ b/manifests/resource/up.pp @@ -14,7 +14,7 @@ exec { "initialize DRBD metadata for ${name}": command => "yes yes | drbdadm create-md ${name}", onlyif => "test -e ${disk}", - unless => "drbdadm dump-md ${name} || (drbdadm cstate ${name} | egrep -q '^(Sync|Connected|WFConnection|StandAlone|Verify)')", + unless => "drbdadm dump-md ${name} || (drbdadm cstate ${name} | egrep -q '^(Sync|Connected|Connecting|WFConnection|StandAlone|Verify)')", before => Service['drbd'], require => [ Exec['modprobe drbd'], @@ -41,7 +41,7 @@ # these things should only be done on the primary during initial setup if $initial_setup { exec { "drbd_make_primary_${name}": - command => "drbdadm -- --overwrite-data-of-peer primary ${name}", + command => "drbdadm -- --overwrite-data-of-peer --force primary ${name}", unless => "drbdadm role ${name} | egrep '^Primary'", onlyif => "drbdadm dstate ${name} | egrep '^Inconsistent'", notify => Exec["drbd_format_volume_${name}"], diff --git a/templates/header.res.erb b/templates/header.res.erb index 22343aa..8106b03 100644 --- a/templates/header.res.erb +++ b/templates/header.res.erb @@ -18,6 +18,14 @@ resource <%= @name %> { <% end -%> } + startup { +<% if @startup_parameters -%> + <% @startup_parameters.sort_by {|k, v| k}.each do |k, v| -%> + <%= k %> <%= v %>; + <% end -%> +<% end -%> + } + syncer { verify-alg <%= @verify_alg %>; <% if @rate -%>