aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom De Vylder <tom@penumbra.be>2012-11-27 14:48:55 +0100
committerTom De Vylder <tom@penumbra.be>2012-11-27 14:48:55 +0100
commit1ae807f8b813413c0e93dc9f511b0004a2df78fa (patch)
tree85b0aa156c0984a6b8d833d15f3639b67da4599e
downloadpuppet-nfs-1ae807f8b813413c0e93dc9f511b0004a2df78fa.tar.gz
puppet-nfs-1ae807f8b813413c0e93dc9f511b0004a2df78fa.tar.bz2
Initial commit
-rw-r--r--manifests/config.pp21
-rw-r--r--manifests/init.pp31
-rw-r--r--manifests/install.pp20
-rw-r--r--manifests/params.pp47
-rw-r--r--manifests/service.pp13
5 files changed, 132 insertions, 0 deletions
diff --git a/manifests/config.pp b/manifests/config.pp
new file mode 100644
index 0000000..e55cb59
--- /dev/null
+++ b/manifests/config.pp
@@ -0,0 +1,21 @@
+# = Class nfs::config
+#
+class nfs::config {
+ File {
+ ensure => present,
+ require => Class['::nfs::install'],
+ notify => Service[$::nfs::service_name],
+ owner => $::nfs::config_user,
+ group => $::nfs::config_group,
+ }
+
+ if $::nfs::client {
+ }
+
+ if $::nfs::server {
+ file { $::nfs::config_file:
+ ensure => directory,
+ }
+ }
+}
+
diff --git a/manifests/init.pp b/manifests/init.pp
new file mode 100644
index 0000000..ff197d4
--- /dev/null
+++ b/manifests/init.pp
@@ -0,0 +1,31 @@
+# = Class nfs
+#
+class nfs (
+ $client = $::nfs::params::client,
+ $config_dir = $::nfs::params::config_dir,
+ $config_dir_mode = $::nfs::params::config_dir_mode,
+ $config_file = $::nfs::params::config_file,
+ $config_file_mode = $::nfs::params::config_file_mode,
+ $config_group = $::nfs::params::config_group,
+ $config_user = $::nfs::params::config_user,
+ $daemon_group = $::nfs::params::daemon_group,
+ $daemon_user = $::nfs::params::daemon_user,
+ $pkg_ensure = $::nfs::params::pkg_ensure,
+ $pkg_list = $::nfs::params::pkg_list,
+ $server = $::nfs::params::server,
+ $service_enable = $::nfs::params::service_enable,
+ $service_ensure = $::nfs::params::service_ensure,
+ $service_hasstatus = $::nfs::params::service_hasstatus,
+ $service_name = $::nfs::params::service_name,
+) inherits nfs::params {
+
+ include nfs::install
+ include nfs::config
+ include nfs::service
+
+ Class['nfs::install'] ->
+ Class['nfs::config'] ->
+ Class['nfs::service']
+
+}
+
diff --git a/manifests/install.pp b/manifests/install.pp
new file mode 100644
index 0000000..7f1fef9
--- /dev/null
+++ b/manifests/install.pp
@@ -0,0 +1,20 @@
+# = Class nfs::install
+#
+class nfs::install {
+ if $::nfs::client {
+ @package { $::nfs::pkg_list_client:
+ ensure => $::nfs::pkg_ensure;
+ }
+
+ realize(Package[$::nfs::pkg_list_client])
+ }
+
+ if $::nfs::server {
+ @package { $::nfs::pkg_list_server:
+ ensure => $::nfs::pkg_ensure;
+ }
+
+ realize(Package[$::nfs::pkg_list_server])
+ }
+}
+
diff --git a/manifests/params.pp b/manifests/params.pp
new file mode 100644
index 0000000..86a8a7f
--- /dev/null
+++ b/manifests/params.pp
@@ -0,0 +1,47 @@
+# = Class nfs::params
+#
+class nfs::params {
+
+ $client = true
+ $server = false
+
+ case $::operatingsystem {
+ 'RedHat', 'CentOS': {
+ $config_dir_mode = '0755'
+ $config_file = '/etc/exports'
+ $config_file_mode = '0644'
+ $config_group = 'root'
+ $config_user = 'root'
+ $pkg_ensure = present
+ $pkg_list_client = 'nfs-utils'
+ $pkg_list_server = 'nfs-utils'
+ $service_enable = true
+ $service_ensure = running
+ $service_hasrestart = true
+ $service_hasstatus = true
+ $service_name = ''
+ }
+
+ 'Debian', 'Ubuntu': {
+ $config_dir_mode = '0755'
+ $config_file = '/etc/exports'
+ $config_file_mode = '0644'
+ $config_group = 'root'
+ $config_user = 'root'
+ $pkg_ensure = present
+ $pkg_list_client = 'nfs-common'
+ $pkg_list_server = 'nfs-kernel-server'
+ $service_enable = true
+ $service_ensure = running
+ $service_hasrestart = true
+ $service_hasstatus = true
+ $service_name = 'nfs-kernel-server'
+ }
+
+ default: {
+ fail "Operating system ${::operatingsystem} is not supported yet."
+ }
+ }
+
+}
+
diff --git a/manifests/service.pp b/manifests/service.pp
new file mode 100644
index 0000000..952f90d
--- /dev/null
+++ b/manifests/service.pp
@@ -0,0 +1,13 @@
+# = Class nfs
+#
+class nfs::service {
+ if $::nfs::server {
+ service { $::nfs::service_name:
+ ensure => $::nfs::service_ensure,
+ enable => $::nfs::service_enable,
+ hasstatus => $::nfs::service_hasstatus,
+ require => Class['::nfs::config'];
+ }
+ }
+}
+