Permalink
Browse files

refactoring + rpcbind on RHEL6

 - split classes by distributions
 - replace portmap by rpcbind for RHEL6
 - replace class nfs::base by nfs::client
  • Loading branch information...
1 parent 1ab9376 commit 4228021800384eb3744a78cd7fd584f1d7a8f69d @mbornoz mbornoz committed Nov 4, 2010
View
@@ -17,7 +17,7 @@ Examples
Client node ::
node "my-nfs-client" {
- include nfs::base
+ include nfs::client
nfs::mount {"my mounted one":
share => '/srv/nfs/myshare',
mountpoint => '/mnt/nfs/myshare',
@@ -1,48 +0,0 @@
-class nfs::base {
-
- package { "portmap":
- ensure => present,
- }
-
- case $operatingsystem {
-
- Debian: {
- package { "nfs-common":
- ensure => present,
- }
-
- service { "nfs-common":
- ensure => running,
- enable => true,
- hasstatus => true,
- require => Package["nfs-common"],
- }
-
- service { "portmap":
- ensure => running,
- enable => true,
- hasstatus => false,
- require => Package["portmap"],
- }
- }
-
- RedHat: {
- package { "nfs-utils":
- ensure => present,
- }
-
- service { "netfs":
- enable => true,
- require => [Service["portmap"], Service["nfslock"]],
- }
-
- service { ["portmap", "nfslock"]:
- ensure => running,
- enable => true,
- hasstatus => true,
- require => [Package["portmap"], Package["nfs-utils"]],
- }
- }
-
- }
-}
@@ -0,0 +1,9 @@
+/*
+
+==Class: nfs::base
+
+This class is dedicated to the common parts
+shared by the different distributions
+
+*/
+class nfs::base {}
@@ -0,0 +1,21 @@
+class nfs::client::debian inherits nfs::base {
+
+ package { ["nfs-common", "portmap"]:
+ ensure => present,
+ }
+
+ service { "nfs-common":
+ ensure => running,
+ enable => true,
+ hasstatus => true,
+ require => Package["nfs-common"],
+ }
+
+ service { "portmap":
+ ensure => running,
+ enable => true,
+ hasstatus => false,
+ require => Package["portmap"],
+ }
+
+}
@@ -0,0 +1,53 @@
+class nfs::client::redhat inherits nfs::base {
+
+ package { "nfs-utils":
+ ensure => present,
+ }
+
+ if $lsbmajdistrelease == 6 {
+
+ package {"rpcbind":
+ ensure => present,
+ }
+
+ service {"rpcbind":
+ ensure => running,
+ enable => true,
+ hasstatus => true,
+ require => [Package["rpcbind"], Package["nfs-utils"]],
+ }
+
+ } else {
+
+ package { "portmap":
+ ensure => present,
+ }
+
+ service { "portmap":
+ ensure => running,
+ enable => true,
+ hasstatus => true,
+ require => [Package["portmap"], Package["nfs-utils"]],
+ }
+
+ }
+
+ service {"nfslock":
+ ensure => running,
+ enable => true,
+ hasstatus => true,
+ require => $lsbmajdistrelease ? {
+ 6 => Service["rpcbind"],
+ default => [Package["portmap"], Package["nfs-utils"]]
+ },
+ }
+
+ service { "netfs":
+ enable => true,
+ require => $lsbmajdistrelease ? {
+ 6 => Service["nfslock"],
+ default => [Service["portmap"], Service["nfslock"]],
+ },
+ }
+
+}
@@ -1,4 +1,4 @@
-class nfs::server inherits nfs::base {
+class nfs::server::debian inherits nfs::client::debian {
package {"nfs-kernel-server":
ensure => present,
@@ -7,11 +7,12 @@
exec {"reload_nfs_srv":
command => "/etc/init.d/nfs-kernel-server reload",
refreshonly => true,
- require => Package["nfs-kernel-server"]
+ require => Package["nfs-kernel-server"]
}
service {"nfs-kernel-server":
- enable => "true",
- pattern => "nfsd"
+ enable => "true",
+ pattern => "nfsd"
}
+
}
@@ -30,7 +30,7 @@
unless => "test -d ${mountpoint}",
}
Mount["shared $share by $server"] {
- require => [Exec["create ${mountpoint} and parents"], Class["nfs::base"]],
+ require => [Exec["create ${mountpoint} and parents"], Class["nfs::client"]],
ensure => mounted,
}
}
View
@@ -1,3 +1,17 @@
-
import "classes/*.pp"
import "definitions/*.pp"
+
+class nfs::client {
+ case $operatingsystem {
+ Debian,Ubuntu: { include nfs::client::debian}
+ RedHat,CentOS: { include nfs::client::redhat}
+ default: { notice "Unsupported operatingsystem ${operatingsystem}" }
+ }
+}
+
+class nfs::server {
+ case $operatingsystem {
+ Debian,Ubuntu: { include nfs::server::debian}
+ default: { notice "Unsupported operatingsystem ${operatingsystem}" }
+ }
+}

0 comments on commit 4228021

Please sign in to comment.