Last active
August 18, 2022 09:27
-
-
Save visualskyrim/8d93a8be0a3ef6dd6598ec8550f6eadd to your computer and use it in GitHub Desktop.
A ansible playbook to modify ulimit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: all | |
become: true | |
tasks: | |
- name: configure system settings, file descriptors and number of threads | |
pam_limits: | |
domain: <--your-username--> | |
limit_type: "{{item.limit_type}}" | |
limit_item: "{{item.limit_item}}" | |
value: "{{item.value}}" | |
with_items: | |
- { limit_type: '-', limit_item: 'nofile', value: 65536 } | |
- { limit_type: '-', limit_item: 'nproc', value: 65536 } | |
- { limit_type: 'soft', limit_item: 'memlock', value: unlimited } | |
- { limit_type: 'hard', limit_item: 'memlock', value: unlimited } | |
- name: reload settings from all system configuration files | |
shell: sysctl --system |
@wabmca It append to /etc/security/limits.conf
Thanks again.
Is it compulsory to do sysctl --system?
Thanks again.
Is it compulsory to do sysctl --system?
I think yes, else you need to login again
Thanks for the nice write-up. one correction: sysctl --system is not related to config files under /etc/security/, it is more for sysctl conf files under /etc/sysctl.d/; /run/sysctl.d; etc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Thanks for this playbook.
I want to understand how does this works? Because it is not creating limits file in /etc/security/limits.d/ for the username given.
Please help.
Thanks,
Ahmed