From 24ef469df05f552c5c7d4b5bd46fff740557b4e2 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Thu, 10 Oct 2013 17:37:45 -0400 Subject: Small VIP fixes. This lets us specify the VIP in ::server, and inherit it in all volumes. --- manifests/server.pp | 2 +- manifests/volume.pp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'manifests') diff --git a/manifests/server.pp b/manifests/server.pp index a14419a..a575a06 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -16,7 +16,7 @@ # along with this program. If not, see . class gluster::server( - #$vip = '', # vip of the cluster (optional but recommended) + $vip = '', # vip of the cluster (optional but recommended) $nfs = false, # TODO $shorewall = false, $zone = 'net', # TODO: allow a list of zones diff --git a/manifests/volume.pp b/manifests/volume.pp index 88d7b0d..96e6bc0 100644 --- a/manifests/volume.pp +++ b/manifests/volume.pp @@ -51,8 +51,13 @@ define gluster::volume( default => "stripe ${stripe} ", } + $valid_vip = "${vip}" ? { + '' => $::gluster::server::vip, + default => "${vip}", + } + # returns interface name that has vip, or '' if none are found. - $vipif = inline_template("<%= interfaces.split(',').find_all {|x| '${vip}' == scope.lookupvar('ipaddress_'+x) }[0,1].join('') %>") + $vipif = inline_template("<%= interfaces.split(',').find_all {|x| '${valid_vip}' == scope.lookupvar('ipaddress_'+x) }[0,1].join('') %>") #Gluster::Brick[$bricks] -> Gluster::Volume[$name] # volume requires bricks @@ -113,7 +118,7 @@ define gluster::volume( } # run if vip not defined (bypass mode) or if vip exists on this machine - if ($vip == '' or $vipif != '') { + if ("${valid_vip}" == '' or "${vipif}" != '') { # store command in a separate file to run as bash... # NOTE: we sleep for 5 seconds to give glusterd a chance to @@ -152,7 +157,7 @@ define gluster::volume( } # run if vip not defined (by pass mode) or vip exists on this machine - if ($vip == '' or $vipif != '') { + if ("${valid_vip}" == '' or "${vipif}" != '') { if $start == true { # try to start volume if stopped exec { "/usr/sbin/gluster volume start ${name}": -- cgit