summaryrefslogtreecommitdiffstats
path: root/manifests/brick.pp
diff options
context:
space:
mode:
authorJames Shubin <james@shubin.ca>2013-10-10 19:35:20 -0400
committerJames Shubin <james@shubin.ca>2013-10-10 22:54:33 -0400
commitdb0e06f48d09f94f92fb78087a717b79c9da6eac (patch)
treeb6045e23cf1c3615d20ed07cc25186d1c094cf80 /manifests/brick.pp
parentb9153d8859b11d9672ba285dc0f281b0bdf78119 (diff)
downloadpuppet-gluster-db0e06f48d09f94f92fb78087a717b79c9da6eac.tar.gz
puppet-gluster-db0e06f48d09f94f92fb78087a717b79c9da6eac.tar.xz
puppet-gluster-db0e06f48d09f94f92fb78087a717b79c9da6eac.zip
Automatic brick ordering and finite state machine support.
This patch adds preliminary FSM support. This will be used and abused more extensively in later patches. Automatic brick ordering is an advanced feature and is meant for experienced puppet users. Changing the available bricks before the cluster is built is not currently supported. For that type of magic, please wait for gluster::elastic. This feature expects that you name your bricks and hosts intelligently. Future patches will recommend a specific nomenclature, but for now as long as the brick paths and hostnames follow a padded, incrementing integer pattern, with a common prefix, you shouldn't see any problems.
Diffstat (limited to 'manifests/brick.pp')
-rw-r--r--manifests/brick.pp18
1 files changed, 18 insertions, 0 deletions
diff --git a/manifests/brick.pp b/manifests/brick.pp
index fe13f5d..8ab9241 100644
--- a/manifests/brick.pp
+++ b/manifests/brick.pp
@@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
define gluster::brick(
+ $group = 'default', # grouping for multiple puppet-glusters
# if dev is false, path in $name is used directly after a mkdir -p
$dev = false, # /dev/sdc, /dev/disk/by-id/scsi-36003048007e14f0014ca2743150a5471
$fsuuid = '', # set a uuid for this fs (uuidgen)
@@ -27,6 +28,12 @@ define gluster::brick(
$force = false, # if true, this will overwrite any xfs fs it sees, useful for rebuilding gluster and wiping data. NOTE: there are other safeties in place to stop this.
$areyousure = false # do you allow puppet to do dangerous things ?
) {
+ include gluster::brick::base
+ include gluster::vardir
+
+ #$vardir = $::gluster::vardir::module_vardir # with trailing slash
+ $vardir = regsubst($::gluster::vardir::module_vardir, '\/$', '')
+
# eg: annex1.example.com:/storage1a
$split = split($name, ':') # do some $name parsing
$host = $split[0] # host fqdn
@@ -44,6 +51,17 @@ define gluster::brick(
Gluster::Host[$host] -> Gluster::Brick[$name] # brick requires host
+ # create a brick tag to be collected by the gluster_brick_group_* fact!
+ $safename = regsubst("${name}", '/', '_', 'G') # make /'s safe
+ file { "${vardir}/brick/${safename}.${group}":
+ content => "${name}\n",
+ owner => root,
+ group => root,
+ mode => 644,
+ ensure => present,
+ require => File["${vardir}/brick/"],
+ }
+
$ro_bool = $ro ? { # this has been added as a convenience
true => 'ro',
default => 'rw',