Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

new format for setting os/version specific params #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
117 changes: 44 additions & 73 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use osfamily, 'Debian' is enough

$package = 'nfs-common'
$package_server = 'nfs-kernel-server'
$service = 'nfs-kernel-server'
$process = 'nfs'
$config_file_init = '/etc/default/nfs'
}
'RedHat': {
case $::operatingsystem {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this case is redundant since we are already in the osfamily=RedHat case

'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'
Expand Down