0

This post seems like it might be helpful but I haven't been able to adapt it to my needs. The meat of it is:

$custom_thing = ('custom_thing',{})
create_resources(param, $custom_thing)

full post on serverfault

Here is my Hiera snippet:

limits_limits:
  'nofile.conf':
    'user':  0:999999
    'limit_type':  'nofile'
    'both'  : '131072'
  'nprocs.conf':
    'user':  0:999999
    'limit_type'  :  'nprocs'
    'both'  : '131072'
mr.zog
  • 902
  • 3
  • 16
  • 36

1 Answers1

0

init.pp

class site_limits {

   include limits

  $mylimits = hiera('limits::limits', undef)   if ($mylimits) {
     create_resources('::limits::limits', $mylimits)   } }

and /var/lib/hiera/common.yaml:

limits::limits:
    'nofile.conf':
       'user'   :  0:999999
       'limit_type':  'nofile'
       'both'  : '131072'
    'nprocs.conf':
       'user':  0:999999
       'limit_type'  :  'nproc'
       'both'  : '131072'

That's all you need.

The above generates two files: /etc/security/limits.d/nofile.conf and /etc/security/limits.d/nprocs.conf. They contain one line each:

0:999999 - nofile 131072

and

0:999999 - nproc 131072

respectively. (the dash means "both hard and soft limits."

mr.zog
  • 902
  • 3
  • 16
  • 36