Update PAM Limits with Ansible or AAP

Mindwatering Incorporated

Author: Tripp W Black

Created: 12/03 at 12:41 AM

 

Category:
Linux
RH AAP

Task:
Update the /etc/security/limits.conf via Ansible/AAP and pam_limits module.

Notes:
- See the pam_limits_module documentation for full details
- extras module
- domain: username, @groupname, wildcard, or uid/gid range
- limit_item: limit object to set (e.g. nofile (handles), core, data, cpu, etc.)
- limit_type: hard, soft, or -
- value: the string value of the limit entry to add
- the with_items section is passed to the pam_limits section sequentially


Example:
Code snippet:
---
- name
block:
- name: Set PAM limits
pam_limits:
domain: "{{ item.user }}
limit_type: "{{ item.limit_type }}
limit_item: "{{ item.limit_item }}
value: "{{item.value }}
with_items:
- { domain: notes, limit_type: soft, limit_item: nofile, value: '20000' }
- { domain: notes, limit_type: hard, limit_item: nofile, value: '49152' }
- { domain: notes, limit_type: hard, limit_item: cpu, value: 'unlimited'}

rescue:
- name: Limit item failed
fail:
msg:
- "ERROR occurred in role_notes, playbook: noteslimits.yaml"
- "Failed task: {{ ansible_failed_task.name }}"
- "Failure error message: {{ ansible_failed_result.msg }}"


previous page

×