From b9660cbe53341d4f21e46395140864a183e2ab5f Mon Sep 17 00:00:00 2001 From: Matthias Kneer Date: Sat, 14 Feb 2015 01:30:59 +0100 Subject: [PATCH 01/10] Added _netdev to default mount options to avoid mount failures when network is not yet ready --- manifests/mount.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/mount.pp b/manifests/mount.pp index 649a602..cfc976e 100644 --- a/manifests/mount.pp +++ b/manifests/mount.pp @@ -9,7 +9,7 @@ # define glusterfs::mount ( $device, - $options = 'defaults', + $options = 'defaults,_netdev', $ensure = 'mounted' ) { From 30260bd45de7a23c2f38e720501fb4e4a4841a3d Mon Sep 17 00:00:00 2001 From: Matthias Kneer Date: Wed, 25 Mar 2015 23:27:44 +0100 Subject: [PATCH 02/10] Added the possibility to change the fstype if required to *nfs'. Default is 'glusterfs'. --- README.md | 1 + manifests/mount.pp | 27 ++++++++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8a430dd..bff7c11 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ on the same hardware for optimal performance and optimal fail-over : file { '/var/www': ensure => directory } glusterfs::mount { '/var/www': + fstype => 'glusterfs', device => $::hostname ? { 'client1' => '192.168.0.1:/gv0', 'client2' => '192.168.0.2:/gv0', diff --git a/manifests/mount.pp b/manifests/mount.pp index cfc976e..abf361b 100644 --- a/manifests/mount.pp +++ b/manifests/mount.pp @@ -10,18 +10,31 @@ define glusterfs::mount ( $device, $options = 'defaults,_netdev', + $fstype = 'glusterfs', $ensure = 'mounted' ) { include glusterfs::client - mount { $title: - ensure => $ensure, - device => $device, - fstype => 'glusterfs', - options => $options, - require => Package['glusterfs-fuse'], + if $fstype == 'glusterfs' { + mount { $title: + ensure => $ensure, + device => $device, + fstype => $fstype, + options => $options, + require => Package['glusterfs-fuse'], + } + } + elsif $fstype == 'nfs' { + mount { $title: + ensure => $ensure, + device => $device, + fstype => $fstype, + options => $options, + } + } + else { + fail("$fstype is not a valid filesystem for gluster") } - } From c8f8ffe9f79565b43252441545633e43e2d8e4f3 Mon Sep 17 00:00:00 2001 From: Christophe Vanlancker Date: Wed, 28 Jan 2015 19:22:40 +0100 Subject: [PATCH 03/10] mount resource cannot be remounted, unsupported in gluster-fuse Signed-off-by: Christophe Vanlancker --- manifests/mount.pp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/manifests/mount.pp b/manifests/mount.pp index abf361b..c4be4d3 100644 --- a/manifests/mount.pp +++ b/manifests/mount.pp @@ -9,6 +9,7 @@ # define glusterfs::mount ( $device, + $path = $name, $options = 'defaults,_netdev', $fstype = 'glusterfs', $ensure = 'mounted' @@ -17,7 +18,7 @@ include glusterfs::client if $fstype == 'glusterfs' { - mount { $title: + mount { $path: ensure => $ensure, device => $device, fstype => $fstype, @@ -26,7 +27,7 @@ } } elsif $fstype == 'nfs' { - mount { $title: + mount { $path: ensure => $ensure, device => $device, fstype => $fstype, @@ -34,7 +35,7 @@ } } else { - fail("$fstype is not a valid filesystem for gluster") + fail("${fstype} is not a valid filesystem for gluster") } } From db9d9ae46e1b86034bc044dac9d3d84805b10b4f Mon Sep 17 00:00:00 2001 From: Christophe Vanlancker Date: Thu, 29 Jan 2015 16:35:23 +0100 Subject: [PATCH 04/10] Allow distinguishing between gluster::mount title and path to avoid double entries in fstab Signed-off-by: Christophe Vanlancker --- manifests/mount.pp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/manifests/mount.pp b/manifests/mount.pp index c4be4d3..d23a255 100644 --- a/manifests/mount.pp +++ b/manifests/mount.pp @@ -19,23 +19,24 @@ if $fstype == 'glusterfs' { mount { $path: - ensure => $ensure, - device => $device, - fstype => $fstype, - options => $options, - require => Package['glusterfs-fuse'], + ensure => $ensure, + device => $device, + fstype => $fstype, + options => $options, + remounts => false, + require => Package['glusterfs-fuse'], } } elsif $fstype == 'nfs' { mount { $path: - ensure => $ensure, - device => $device, - fstype => $fstype, - options => $options, + ensure => $ensure, + device => $device, + fstype => $fstype, + remounts => false, + options => $options, } } else { fail("${fstype} is not a valid filesystem for gluster") } } - From bf2f86e6f9caedb03db6654c5d48fd8ba95fac16 Mon Sep 17 00:00:00 2001 From: Georges Bossert Date: Thu, 19 Feb 2015 15:33:41 +0100 Subject: [PATCH 05/10] Update 'unless' condition before triggering a glusterfs volume startup. IMHO, previous 'unless' statement was ineffective to prevent successive attempts of volume startup leading to multiple log entries. --- manifests/volume.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/volume.pp b/manifests/volume.pp index 7a6ae2b..a7752ae 100644 --- a/manifests/volume.pp +++ b/manifests/volume.pp @@ -18,7 +18,7 @@ } exec { "/usr/sbin/gluster volume start ${title}": - unless => "[ \"`gluster volume info ${title} | egrep '^Status:'`\" = 'Status: Started' ]", + unless => "gluster volume info ${title} | grep '^Status: Started' > /dev/null", path => [ '/usr/sbin', '/usr/bin', '/sbin', '/bin' ], require => Exec["gluster volume create ${title}"], } From b7a47d2ffddf406fc0282b54592116b88103b42c Mon Sep 17 00:00:00 2001 From: Dave Seff Date: Wed, 25 Feb 2015 09:00:21 -0500 Subject: [PATCH 06/10] Some minor fixes - Do not probe local host - Fix the checking of the Started condition of the volume. --- manifests/peer.pp | 9 +++++---- manifests/volume.pp | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/manifests/peer.pp b/manifests/peer.pp index 028cd30..51abe07 100644 --- a/manifests/peer.pp +++ b/manifests/peer.pp @@ -6,10 +6,11 @@ # define glusterfs::peer () { - exec { "/usr/sbin/gluster peer probe ${title}": - unless => "/bin/egrep '^hostname.+=${title}$' /var/lib/glusterd/peers/*", - require => Service['glusterd'], + if $hostname != $title { # No need to probe local host + exec { "/usr/sbin/gluster peer probe ${title}": + unless => "/bin/egrep '^hostname.+=${title}$' /var/lib/glusterd/peers/*", + require => Service['glusterfs-server'], + } } - } diff --git a/manifests/volume.pp b/manifests/volume.pp index a7752ae..a96ccd1 100644 --- a/manifests/volume.pp +++ b/manifests/volume.pp @@ -18,7 +18,7 @@ } exec { "/usr/sbin/gluster volume start ${title}": - unless => "gluster volume info ${title} | grep '^Status: Started' > /dev/null", + unless => "gluster volume info ${title} | grep -q '^Status: Started'", path => [ '/usr/sbin', '/usr/bin', '/sbin', '/bin' ], require => Exec["gluster volume create ${title}"], } From ada5a1234d2254bec2b046e156e21c099a3925d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Fri, 10 Apr 2015 16:42:14 +0200 Subject: [PATCH 07/10] replace Modulefile with metadata.json --- ChangeLog | 3 +++ Modulefile | 8 -------- metadata.json | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 8 deletions(-) delete mode 100644 Modulefile create mode 100644 metadata.json diff --git a/ChangeLog b/ChangeLog index 229ef3b..914d2cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2015-04-10 - 0.0.4 +* replace Modulefile with metadata.json + 2013-05-24 - 0.0.3 * Update README and use markdown. * Change to 2-space indent. diff --git a/Modulefile b/Modulefile deleted file mode 100644 index 4f58683..0000000 --- a/Modulefile +++ /dev/null @@ -1,8 +0,0 @@ -name 'thias-glusterfs' -version '0.0.3' -source 'git://github.com/thias/puppet-glusterfs' -author 'Matthias Saou' -license 'Apache 2.0' -summary 'GlusterFS module' -description "Install, enable and configure GlusterFS servers and clients." -project_page 'https://github.com/thias/puppet-glusterfs' diff --git a/metadata.json b/metadata.json new file mode 100644 index 0000000..0aa0c1c --- /dev/null +++ b/metadata.json @@ -0,0 +1,26 @@ +{ + "name": "thias-glusterfs", + "version": "0.0.4", + "author": "Matthias Saou", + "summary": "GlusterFS module", + "description": "Install, enable and configure GlusterFS servers and clients", + "license": "Apache-2.0", + "source": "https://github.com/thias/puppet-glusterfs", + "project_page": "https://github.com/thias/puppet-glusterfs", + "issues_url": "https://github.com/thias/puppet-glusterfs/issues", + "dependencies": [], + "operatingsystem_support": [ + { + "operatingsystem": "Ubuntu" + }, + { + "operatingsystem": "Debian" + }, + { + "operatingsystem": "RedHat" + }, + { + "operatingsystem": "CentOS" + } + ] +} From 529d7c9ef32e23ac72facecfe83370599be112a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Fri, 10 Apr 2015 16:50:07 +0200 Subject: [PATCH 08/10] param-etrize glusterfs service name we use the params pattern here, while at the same time making service_name overwritable as parameter. n.b.: we could/should do this for all other parameters. --- manifests/params.pp | 12 ++++++++++++ manifests/server.pp | 8 +++++--- 2 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 manifests/params.pp diff --git a/manifests/params.pp b/manifests/params.pp new file mode 100644 index 0000000..e436f29 --- /dev/null +++ b/manifests/params.pp @@ -0,0 +1,12 @@ +# Set default values here that are different accross OSes +class glusterfs::params { + + case $::osfamily { + 'Debian': { + $service_name = 'glusterfs-server' + } + default, 'RedHat': { + $service_name = 'glusterd' + } + } +} diff --git a/manifests/server.pp b/manifests/server.pp index 1aad37e..f8c89bd 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -15,15 +15,17 @@ # } # class glusterfs::server ( - $peers = [] -) { + $peers = [], + $service_name = $::glusterfs::params::service_name, +) inherits glusterfs::params { # Main package and service it provides package { 'glusterfs-server': ensure => installed } service { 'glusterd': - enable => true, ensure => running, + enable => true, hasstatus => true, + name => $service_name, require => Package['glusterfs-server'], } From 3e3f3ed25492511afb032bc39428825169d18b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Fri, 10 Apr 2015 16:57:07 +0200 Subject: [PATCH 09/10] param-etrize glusterfs client package name again we expose the client package name through as class parameter, determining the value through glusterfs::params. --- manifests/client.pp | 9 +++++++-- manifests/params.pp | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index 1088e1e..c8d0eb9 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -2,9 +2,14 @@ # # GlusterFS client. See glusterfs::mount instead. # -class glusterfs::client { +class glusterfs::client ( + $client_package_name = $::glusterfs::params::client_package_name, +) inherits glusterfs::params { - package { 'glusterfs-fuse': ensure => installed } + package { 'glusterfs-fuse': + ensure => installed, + name => $client_package_name, + } } diff --git a/manifests/params.pp b/manifests/params.pp index e436f29..959dddb 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -3,10 +3,12 @@ case $::osfamily { 'Debian': { - $service_name = 'glusterfs-server' + $service_name = 'glusterfs-server' + $client_package_name = 'glusterfs-client' } default, 'RedHat': { - $service_name = 'glusterd' + $service_name = 'glusterd' + $client_package_name = 'glusterfs-fuse' } } } From 2f39f80fc04ab17a1c12ff65eff5ece0519fa800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Fri, 17 Apr 2015 19:58:26 +0200 Subject: [PATCH 10/10] do a loser check on peer's hostname this way we can match against the fqdn as well as the hostname --- manifests/peer.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/peer.pp b/manifests/peer.pp index 51abe07..f44b43f 100644 --- a/manifests/peer.pp +++ b/manifests/peer.pp @@ -6,7 +6,7 @@ # define glusterfs::peer () { - if $hostname != $title { # No need to probe local host + unless $::hostname in $title { # No need to probe local host exec { "/usr/sbin/gluster peer probe ${title}": unless => "/bin/egrep '^hostname.+=${title}$' /var/lib/glusterd/peers/*", require => Service['glusterfs-server'],