Documentation
PLEASE NOTE: This document applies to latest version and not to the latest stable release v3.0
Documentation for other releases can be found by using the version selector in the top right of any doc page.pam_limits
Manage Linux PAM limits (ulimits).
Attributes
check_mode:
support: full
Parameters
| Parameter | Required | Type | Values | Description |
|---|---|---|---|---|
| domain | true | string | A username, @groupname, wildcard *, or UID/GID range. | |
| limit_type | true | string | hard soft - |
Limit type: hard, soft, or - (both). |
| item | true | string | core data fsize memlock nofile rss stack cpu nproc as maxlogins maxsyslogins priority locks sigpending msgqueue nice rtprio chroot |
The limit item to set. |
| value | string | The value of the limit. Required when state=present. | ||
| state | string | present absent |
Whether the entry should be present or absent. [default: "present"] |
|
| dest | string | Path to the limits.conf file. [default: "/etc/security/limits.conf"] |
||
| comment | string | Comment associated with the limit. | ||
| backup | boolean | Create a backup file before modifying. [default: false] |
Examples
- name: Set max open files limit for nginx user
pam_limits:
domain: nginx
limit_type: soft
item: nofile
value: "65535"
- name: Set hard limit for max processes
pam_limits:
domain: '*'
limit_type: hard
item: nproc
value: "4096"
- name: Remove memlock limit for user
pam_limits:
domain: myuser
limit_type: soft
item: memlock
value: unlimited
- name: Set limits in a custom file with comment
pam_limits:
domain: "@developers"
limit_type: "-"
item: nofile
value: "100000"
dest: /etc/security/limits.d/99-developers.conf
comment: Custom limits for developers
- name: Ensure limit does not exist
pam_limits:
domain: olduser
limit_type: soft
item: nofile
state: absent