Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
212 changes: 212 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
# Reference

<!-- DO NOT EDIT: This document was generated by Puppet Strings -->

## Table of Contents

### Classes

* [`limits`](#limits): Manage user and group limits via Puppet

### Defined types

* [`limits::limits`](#limits--limits): Manage individual user/group limits

## Classes

### <a name="limits"></a>`limits`

== Class: limits
This module manages the limits of the PAM module pam_limits.

#### Examples

#####

```puppet
include limits
```

#### Parameters

The following parameters are available in the `limits` class:

* [`limits_dir`](#-limits--limits_dir)
* [`manage_limits_d_dir`](#-limits--manage_limits_d_dir)
* [`purge_limits_d_dir`](#-limits--purge_limits_d_dir)
* [`limits_file`](#-limits--limits_file)
* [`manage_limits_file`](#-limits--manage_limits_file)
* [`limits_file_owner`](#-limits--limits_file_owner)
* [`limits_file_group`](#-limits--limits_file_group)
* [`limits_file_mode`](#-limits--limits_file_mode)
* [`limits_template`](#-limits--limits_template)
* [`entries`](#-limits--entries)

##### <a name="-limits--limits_dir"></a>`limits_dir`

Data type: `String[1]`

Directory for individual limits config files

##### <a name="-limits--manage_limits_d_dir"></a>`manage_limits_d_dir`

Data type: `Boolean`

Manage $limits_dir itself

##### <a name="-limits--purge_limits_d_dir"></a>`purge_limits_d_dir`

Data type: `Boolean`

Purge $limits_dir

##### <a name="-limits--limits_file"></a>`limits_file`

Data type: `String[1]`

Basic limits configuration file

##### <a name="-limits--manage_limits_file"></a>`manage_limits_file`

Data type: `Boolean`

Manage $limits_file

##### <a name="-limits--limits_file_owner"></a>`limits_file_owner`

Data type: `String[1]`

Owner of $limits_file

##### <a name="-limits--limits_file_group"></a>`limits_file_group`

Data type: `String[1]`

Group $limits_file

##### <a name="-limits--limits_file_mode"></a>`limits_file_mode`

Data type: `String[1]`

Mode $limits_file

##### <a name="-limits--limits_template"></a>`limits_template`

Data type: `String[1]`

Name of the template to use for $limits_file

##### <a name="-limits--entries"></a>`entries`

Data type: `Optional[Hash[String[1], Hash[Pattern[/\A[a-z][a-z0-9_]*\Z/], Data], 1]]`

limits configuration file(s) entries

## Defined types

### <a name="limits--limits"></a>`limits::limits`

This defined type creates individual limit configuration files in the limits.d directory.
The title should be of the form user/limit_type if $user and $limit_type are not provided separately.

#### Examples

##### Setting file descriptor limits for all users

```puppet
limits::limits{'*/nofile':
hard => 12345,
soft => 123,
}
```

##### Setting limits using both parameter

```puppet
limits::limits{'root/nofile':
both => 1234,
}
```

##### Multiple settings in single file

```puppet
limits::limits{'root/nofile':
both => 1234,
target => '01-root.conf',
}
limits::limits{'root/nproc':
both => 1234,
target => '01-root.conf',
}
```

#### Parameters

The following parameters are available in the `limits::limits` defined type:

* [`ensure`](#-limits--limits--ensure)
* [`user`](#-limits--limits--user)
* [`limit_type`](#-limits--limits--limit_type)
* [`hard`](#-limits--limits--hard)
* [`soft`](#-limits--limits--soft)
* [`both`](#-limits--limits--both)
* [`target`](#-limits--limits--target)

##### <a name="-limits--limits--ensure"></a>`ensure`

Data type: `Enum['absent', 'present']`

Whether the limit configuration should be present or absent

Default value: `present`

##### <a name="-limits--limits--user"></a>`user`

Data type: `Optional[String[1]]`

The user or group name to apply limits to. If not specified, extracted from title

Default value: `undef`

##### <a name="-limits--limits--limit_type"></a>`limit_type`

Data type: `Optional[String[1]]`

The type of limit to set (e.g., 'nofile', 'nproc', 'core'). If not specified, extracted from title

Default value: `undef`

##### <a name="-limits--limits--hard"></a>`hard`

Data type: `Optional[Variant[Integer, String]]`

The hard limit value

Default value: `undef`

##### <a name="-limits--limits--soft"></a>`soft`

Data type: `Optional[Variant[Integer, String]]`

The soft limit value

Default value: `undef`

##### <a name="-limits--limits--both"></a>`both`

Data type: `Optional[Variant[Integer, String]]`

Set both hard and soft limits to the same value (uses '-' in limits file)

Default value: `undef`

##### <a name="-limits--limits--target"></a>`target`

Data type: `Optional[String[1]]`

Name of file in `limits::limits_dir` directory where settings will be applied.
If provided, title with `.conf` extension will not be used as target file.

Default value: `undef`

35 changes: 13 additions & 22 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,29 @@
#
# This module manages the limits of the PAM module pam_limits.
#
# @example
# include limits
#
# @param limits_dir
# Directory for individual limits config files
#
# Directory for individual limits config files
# @param manage_limits_d_dir
# Manage $limits_dir itself
#
# Manage $limits_dir itself
# @param purge_limits_d_dir
# Purge $limits_dir
#
# Purge $limits_dir
# @param limits_file
# Basic limits configuration file
#
# Basic limits configuration file
# @param manage_limits_file
# Manage $limits_file
#
# Manage $limits_file
# @param limits_file_owner
# Owner of $limits_file
#
# Owner of $limits_file
# @param limits_file_group
# Group $limits_file
#
# Group $limits_file
# @param limits_file_mode
# Mode $limits_file
#
# Mode $limits_file
# @param limits_template
# Name of the template to use for $limits_file
#
# Name of the template to use for $limits_file
# @param entries
# limits configuration file(s) entries
# limits configuration file(s) entries
#
# @example
# include limits
#
class limits (
String[1] $limits_dir,
Expand Down
63 changes: 43 additions & 20 deletions manifests/limits.pp
Original file line number Diff line number Diff line change
@@ -1,27 +1,50 @@
# == Define: limits::limits
# @summary Manage individual user/group limits
#
# Parameters:
# $title - should be of the form user/limit_type if $user and $limt_type are not present
# $user - user
# $limit_type - limit type / item
# $hard - hard limit
# $soft - soft limit
# $both - set both limits (-)
# $target - name of file in `limits::limits_dir` directory the settings will be applied. If provided, title with `.conf` extension will be not be used as target file.
# This defined type creates individual limit configuration files in the limits.d directory.
# The title should be of the form user/limit_type if $user and $limit_type are not provided separately.
#
# Example:
# limits::limits{'*/nofile':
# hard => 12345,
# soft => 123,
# }
# limits::limits{'root/nofile': both => 1234; }
# @param ensure
# Whether the limit configuration should be present or absent
#
# Example of multiple settings in single file
# limits::limits{'root/nofile': both => 1234, target => '01-root.conf' }
# limits::limits{'root/nproc': both => 1234, target => '01-root.conf' }
# @param user
# The user or group name to apply limits to. If not specified, extracted from title
#
# Manages:
# limit file in limits.d with the values provided
# @param limit_type
# The type of limit to set (e.g., 'nofile', 'nproc', 'core'). If not specified, extracted from title
#
# @param hard
# The hard limit value
#
# @param soft
# The soft limit value
#
# @param both
# Set both hard and soft limits to the same value (uses '-' in limits file)
#
# @param target
# Name of file in `limits::limits_dir` directory where settings will be applied.
# If provided, title with `.conf` extension will not be used as target file.
#
# @example Setting file descriptor limits for all users
# limits::limits{'*/nofile':
# hard => 12345,
# soft => 123,
# }
#
# @example Setting limits using both parameter
# limits::limits{'root/nofile':
# both => 1234,
# }
#
# @example Multiple settings in single file
# limits::limits{'root/nofile':
# both => 1234,
# target => '01-root.conf',
# }
# limits::limits{'root/nproc':
# both => 1234,
# target => '01-root.conf',
# }
define limits::limits (
Enum['absent', 'present'] $ensure = present,
Optional[String[1]] $user = undef,
Expand Down
Loading