From c7107c90d58fc81bd3b15e71cc90fa6f911e67b1 Mon Sep 17 00:00:00 2001
From: Adam Lewenberg <adamhl@stanford.edu>
Date: Fri, 10 May 2013 15:41:53 -0700
Subject: [PATCH] move portmap to base

---
 manifests/portmap.pp | 53 ++++++++++++++++++++++++++++++++++++++++++++
 manifests/rstatd.pp  |  2 +-
 2 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 manifests/portmap.pp

diff --git a/manifests/portmap.pp b/manifests/portmap.pp
new file mode 100644
index 0000000..e75487c
--- /dev/null
+++ b/manifests/portmap.pp
@@ -0,0 +1,53 @@
+#
+# Portmap service for Sun RPC.  Needed on systems providing RPC services, such
+# as NFS servers, and occasionally for other reasons.
+
+# This class intentionally does not add iptables rules.  You should add with
+# server-specific iptables rules to allow only specific sites to talk to port
+# 111.
+class base::portmap {
+
+  case $::operatingsystem {
+    'redhat': {
+        include base::xinetd
+
+            case $::lsbdistcodename {
+
+                'santiago': {
+                    package { 'rpcbind': ensure => present }
+                    service { 'rpcbind': ensure => running }
+                }
+                default: {
+                    package { 'portmap': ensure => present }
+
+                    # Ensure service is running.  Also notify xinetd in case the
+                    # services need to be re-registered with the portmap.
+                    service { 'portmap':
+                        ensure    => running,
+                        enable    => true,
+                        hasstatus => true,
+                        require   => Package['portmap'],
+                        restart   => '/etc/init.d/portmap restart',
+                        notify    => Service['xinetd'],
+                    }
+                }# rhel4/5
+            }
+    }
+    'debian': {
+        package { 'portmap': ensure => present }
+        service{ 'portmap':
+            ensure    => running,
+            enable    => true,
+            hasstatus => false,
+            status    => 'pidof portmap',
+            require   => Package['portmap'],
+            restart   => '/etc/init.d/portmap restart',
+        }
+    }
+    # Ubuntu 11.10 switched to "rpcbind" like EL6
+    'ubuntu': {
+        package { 'rpcbind': ensure => present }
+        service { 'portmap': ensure => running }
+    }
+  }
+}
diff --git a/manifests/rstatd.pp b/manifests/rstatd.pp
index 19aa535..4fa549e 100644
--- a/manifests/rstatd.pp
+++ b/manifests/rstatd.pp
@@ -4,7 +4,7 @@
 
 class base::rstatd {
     include base::xinetd,
-            portmap
+            base::portmap
 
     case $::operatingsystem {
         'redhat': {
-- 
GitLab