diff --git a/manifests/params.pp b/manifests/params.pp index 8ca49e1..8488fd7 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -17,79 +17,50 @@ ### Application related parameters $mode = 'server' - - $package = $::operatingsystem ? { - /(?i:Debian|Ubuntu|Mint)/ => 'nfs-common', - default => 'nfs-utils', - } - - $package_server = $::operatingsystem ? { - /(?i:Debian|Ubuntu|Mint)/ => 'nfs-kernel-server', - default => '' - } - - $service = $::operatingsystem ? { - /(?i:Debian|Ubuntu|Mint)/ => 'nfs-kernel-server', - /(?i:RedHat|Centos|Scientific)/ => 'nfs-server', - default => 'nfs', - } - - $service_status = $::operatingsystem ? { - default => true, - } - - $process = $::operatingsystem ? { - /(?i:RedHat|Centos|Scientific)/ => 'nfsd', - default => 'nfs', - } - - $process_args = $::operatingsystem ? { - default => '', - } - - $process_user = $::operatingsystem ? { - default => 'root', - } - - $config_dir = $::operatingsystem ? { - default => '', - } - - $config_file = $::operatingsystem ? { - default => '/etc/exports', - } - - $config_file_mode = $::operatingsystem ? { - default => '0644', - } - - $config_file_owner = $::operatingsystem ? { - default => 'root', - } - - $config_file_group = $::operatingsystem ? { - default => 'root', - } - - $config_file_init = $::operatingsystem ? { - /(?i:Debian|Ubuntu|Mint)/ => '/etc/default/nfs', - default => '/etc/sysconfig/nfs', - } - - $pid_file = $::operatingsystem ? { - default => '/var/run/nfs.pid', - } - - $data_dir = $::operatingsystem ? { - default => '/etc/nfs', - } - - $log_dir = $::operatingsystem ? { - default => '/var/log/nfs', - } - - $log_file = $::operatingsystem ? { - default => '/var/log/nfs/nfs.log', + $service_status = true + $process_args = '' + $process_user = 'root' + $config_dir = '' + $config_file = '/etc/exports' + $config_file_mode = '0644' + $config_file_owner = 'root' + $config_file_group = 'root' + $pid_file = '/var/run/nfs.pid' + $data_dir = '/etc/nfs' + $log_dir = '/var/log/nfs' + $log_file = '/var/log/nfs/nfs.log' + + + case $::osfamily { + 'Debian', 'Ubuntu', 'Mint': { + $package = 'nfs-common' + $package_server = 'nfs-kernel-server' + $service = 'nfs-kernel-server' + $process = 'nfs' + $config_file_init = '/etc/default/nfs' + } + 'RedHat': { + case $::operatingsystem { + 'RedHat', 'CentOS', 'OracleLinux', 'Scientific': { + if (versioncmp($::operatingsystemrelease, '7.0') < 0) { # less than 7.0 + $package = 'nfs-utils' + $package_server = '' + $service = 'nfs' + $process = 'nfsd' + $config_file_init = '/etc/sysconfig/nfs' + } + else { #7.0+ + $package = 'nfs-utils' + $package_server = '' + $service = 'nfs-server' + $process = 'nfsd' + $config_file_init = '/etc/sysconfig/nfs' + } + } + default: { fail("unsupported os ${::operatingsystem}") } + } + } + default: { fail("unsupported os ${::operatingsystem}") } } $port = '2049'