Created
December 21, 2012 09:39
-
-
Save raphink/4351767 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define limits::limit ($user,$type,$item,$value,$file='/etc/security/limits.conf'){ | |
$key = "$user/$type/$item" | |
$path_list = "domain[.=\"$user\"][type=\"$type\" and item=\"$item\"]" | |
$path_exact = "domain[.=\"$user\"][type=\"$type\" and item=\"$item\" and value=\"$value\"]" | |
augeas { "limits_conf/${key}/": | |
lens => 'Limits.lns', | |
incl => $file, | |
onlyif => "match $path_exact size==0", | |
changes => [ | |
"rm $path_list", | |
"set domain[last()+1] $user", | |
"set domain[last()]/type $type", | |
"set domain[last()]/item $item", | |
"set domain[last()]/value $value", | |
], | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment