Defined Type: psick::limits::limit
- Defined in:
- manifests/limits/limit.pp
Summary
Manages a limit file in the /etc/security/limits.d directoryOverview
Title of the define can have format like: domain/item otherwise the relevant parameters have to be defined.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'manifests/limits/limit.pp', line 31
define psick::limits::limit (
Enum['absent', 'present'] $ensure = present,
Optional[String] $domain = undef,
Optional[String] $item = undef,
Variant[Integer,String,Undef] $hard = undef,
Variant[Integer,String,Undef] $soft = undef,
Variant[Integer,String,Undef] $both = undef,
) {
include psick::limits
if $ensure == 'present' {
unless $hard or $soft or $both { fail('You have to define one of $hard, $soft or $both') }
}
unless $title =~ /\// {
unless $domain and $item { fail('If title is not in $domain/item format, $domain and $item are required') }
}
$title_split = split($title, '/')
$real_domain = pick($domain, $title_split[0])
$real_item = pick($item, $title_split[1])
if $title !~ /\// {
$file_path = "${psick::limits::limits_dir_path}/${title}.conf"
} else {
if $real_domain == '*' {
$file_path = "${psick::limits::limits_dir_path}/default_${real_item}.conf"
} else {
$file_path = "${psick::limits::limits_dir_path}/${real_domain}_${real_item}.conf"
}
}
file { $file_path:
ensure => $ensure,
owner => 'root',
group => 'root',
content => template('psick/limits/limit.erb'),
}
}
|