ansible.builtin.pam_limits (v2.5.15) — module

Modify Linux PAM limits

| "added in version" 2.0 of ansible.builtin"

Authors: Sebastien Rohaut (@usawa)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.5.15

Description

The C(pam_limits) module modify PAM limits, default in /etc/security/limits.conf. For the full documentation, see man limits.conf(5).

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Add or modify nofile soft limit for the user joe
- pam_limits:
    domain: joe
    limit_type: soft
    limit_item: nofile
    value: 64000
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Add or modify fsize hard limit for the user smith. Keep or set the maximal value.
- pam_limits:
    domain: smith
    limit_type: hard
    limit_item: fsize
    value: 1000000
    use_max: yes
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Add or modify memlock, both soft and hard, limit for the user james with a comment.
- pam_limits:
    domain: james
    limit_type: '-'
    limit_item: memlock
    value: unlimited
    comment: unlimited memory lock for james

Inputs

    
dest:
    default: /etc/security/limits.conf
    description:
    - Modify the limits.conf path.
    required: false

value:
    description:
    - The value of the limit.
    required: true

backup:
    choices:
    - 'yes'
    - 'no'
    default: 'no'
    description:
    - Create a backup file including the timestamp information so you can get the original
      file back if you somehow clobbered it incorrectly.
    required: false

domain:
    description:
    - A username, @groupname, wildcard, uid/gid range.
    required: true

comment:
    default: ''
    description:
    - Comment associated with the limit.
    required: false

use_max:
    choices:
    - 'yes'
    - 'no'
    default: 'no'
    description:
    - If set to C(yes), the maximal value will be used or conserved. If the specified
      value is superior to the value in the file, file content is replaced with the new
      value, else content is not modified.
    required: false

use_min:
    choices:
    - 'yes'
    - 'no'
    default: 'no'
    description:
    - If set to C(yes), the minimal value will be used or conserved. If the specified
      value is inferior to the value in the file, file content is replaced with the new
      value, else content is not modified.
    required: false

limit_item:
    choices:
    - core
    - data
    - fsize
    - memlock
    - nofile
    - rss
    - stack
    - cpu
    - nproc
    - as
    - maxlogins
    - maxsyslogins
    - priority
    - locks
    - sigpending
    - msgqueue
    - nice
    - rtprio
    - chroot
    description:
    - The limit to be set
    required: true

limit_type:
    choices:
    - hard
    - soft
    - '-'
    description:
    - Limit type, see C(man limits) for an explanation
    required: true