Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looser check #15

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
8 changes: 0 additions & 8 deletions Modulefile

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
9 changes: 7 additions & 2 deletions manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

}

33 changes: 24 additions & 9 deletions manifests/mount.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,34 @@
#
define glusterfs::mount (
$device,
$options = 'defaults',
$path = $name,
$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 { $path:
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,
remounts => false,
options => $options,
}
}
else {
fail("${fstype} is not a valid filesystem for gluster")
}

}

14 changes: 14 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Set default values here that are different accross OSes
class glusterfs::params {

case $::osfamily {
'Debian': {
$service_name = 'glusterfs-server'
$client_package_name = 'glusterfs-client'
}
default, 'RedHat': {
$service_name = 'glusterd'
$client_package_name = 'glusterfs-fuse'
}
}
}
9 changes: 5 additions & 4 deletions manifests/peer.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
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'],
}
}

}

8 changes: 5 additions & 3 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
}

Expand Down
2 changes: 1 addition & 1 deletion manifests/volume.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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 -q '^Status: Started'",
path => [ '/usr/sbin', '/usr/bin', '/sbin', '/bin' ],
require => Exec["gluster volume create ${title}"],
}
Expand Down
26 changes: 26 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}