Forge Home

limits

Manage entries in /etc/security/limits.conf

7,428,888 downloads

7,423,471 latest version

3.4 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.3.1 (latest)
  • 0.3.0
  • 0.2.0
released Dec 19th 2012

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'erwbgy-limits', '0.3.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add erwbgy-limits
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install erwbgy-limits --version 0.3.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

erwbgy/limits — version 0.3.1 Dec 19th 2012

puppet-limits

Puppet module to set entries in /etc/security/limits.conf

limits

The recommended usage is to place the configuration under a limits hash in hiera and just include the limits module in your puppet configuration:

include limits

Example hiera config:

limits:
  '*':
    nofile:
      soft: '2048'
      hard: '8192'
    nproc:
      soft: '20'
      hard: '20'
  'myuser':
    nofile:
      soft: '4068'
      hard: '8192'
  '@mygroup':
    nproc:
      hard: '50'
  

This example creates the following entries in /etc/security/limits.conf:

* nofile soft 2048
* nofile hard 8192
myuser nofile soft 4068
myuser nofile hard 8192
* nproc soft 20
* nproc hard 20
@mygroup nproc hard 50

replacing any existing items in the same domain.

You can also call it as a parameterised class passing in the configuration data as a hash - for example:

class { 'limits':
  config => {
    '*' => {
      'nofile' => {
        soft => '2048',
        hard => '8192',
      },
      'nproc' => {
        soft => '20',
        hard => '20',
      },
    },
    '@mygroup' => {
      'nproc' => {
        hard => '50',
      }
    },
  },
  use_hiera => false,
}

Parameters

Each entry title is the domain name - for example '*' for all users, '@wheel' for members of the wheel group, 'root' for the root user etc.

For each domain there is one or more items: one of: 'core', 'data', 'fsize', 'memlock', 'nofile', 'rss', 'stack', 'cpu', 'nproc', 'as', 'maxlogins', 'maxsyslogins', 'priority', 'locks', 'sigpending', 'msqqueue', 'nice', 'rtprio'.

For each item the following parameters are accepted:

  • soft: the item's soft limit. Optional.

  • hard: the item's hard limit. Optional.

See the limits.conf(5) man page for more information.

Implementation based on https://projects.puppetlabs.com/projects/puppet/wiki/Puppet_Augeas