I try to edit the file limits.com with puppet. I need to add lines this files. I copy the example from: http://docs.puppetlabs.com/guides/augeas.html
# /etc/puppet/modules/limits/manifests/conf.pp
define limits::conf (
$domain = "root",
$type = "soft",
$item = "nofile",
$value = "10000"
) {
# guid of this entry
$key = "$domain/$type/$item"
# augtool> match /files/etc/security/limits.conf/domain[.="root"][./type="hard" and ./item="nofile" and ./value="10000"]
$context = "/files/etc/security/limits.conf"
$path_list = "domain[.=\"$domain\"][./type=\"$type\" and ./item=\"$item\"]"
$path_exact = "domain[.=\"$domain\"][./type=\"$type\" and ./item=\"$item\" and ./value=\"$value\"]"
augeas { "limits_conf/$key":
context => "$context",
onlyif => "match $path_exact size != 1",
changes => [
# remove all matching to the $domain, $type, $item, for any $value
"rm $path_list",
# insert new node at the end of tree
"set domain[last()+1] $domain",
# assign values to the new node
"set domain[last()]/type $type",
"set domain[last()]/item $item",
"set domain[last()]/value $value",
],
}
and use case:
limits::conf {
# maximum number of open files/sockets for root
"root-soft": domain => root, type => soft, item => nofile, value => 9999;
"root-hard": domain => root, type => hard, item => nofile, value => 9999;
}
The result inside of limits.conf is:
#@student - maxlogins 4
root hard nofile 9999
root soft nofile 9999
How I can put whitespace or tabs bettwen the values "root hard nofile & value" I try put the whitespace inside "", try with regex but doesn't works. Thanks