I am setting up a MySQL server, and I was told to increase the ulimit
for the number of open processes.
I ran
- name: "increase limit for the number of open files"
shell: "ulimit -n 64000"
- name: "increase limit for the number of open processes"
shell: "ulimit -u 64000"
on the ansible-playbook
, but not only does it throw error "Illegal option -u", but also open files limit (-n) doesn't seem to get modified. (I ran ulimit -n
on the server but it stays the same)
What is the recommended way of increasing these limits, and how should I do it in Ansible?
I saw pam_limits
module. Should I use this module to modify nproc
and nofile
? If so, which domain?
Thank you.
Note: Ansible does not require root access; however, if you choose to use a non-root user, you must configure the appropriate sudo permissions for the tasks you want to accomplish. You will be prompted for the root password for servera, which will allow your SSH key to be installed on the remote host.
Ansible ini_file module This module is a life-saver when modifying ini type files with many changes.
You are right that Ansible is slow (as a hell). It is by design. They decided to copy python code through ssh to remote hosts to perform operations: code need to be base64 encoded/decoded - CPU load/time/bloated network.
Since Ansible 2.0.0, a new official module supports configuring PAM.
# Add or modify nofile soft limit for the user joe
- pam_limits:
domain: joe
limit_type: soft
limit_item: nofile
value: 64000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With