ulimits.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. - name: Setup nofile for system
  2. become: true
  3. ansible.builtin.lineinfile:
  4. path: /etc/systemd/system.conf
  5. regexp: "^DefaultLimitNOFILE="
  6. line: DefaultLimitNOFILE=2097152
  7. backup: true
  8. - name: Setup nproc for system
  9. become: true
  10. ansible.builtin.lineinfile:
  11. path: /etc/systemd/system.conf
  12. regexp: "^DefaultLimitNPROC"
  13. line: DefaultLimitNPROC=524288
  14. backup: true
  15. - name: Setup nofile for user
  16. become: true
  17. ansible.builtin.lineinfile:
  18. path: /etc/systemd/user.conf
  19. regexp: "^DefaultLimitNOFILE="
  20. line: DefaultLimitNOFILE=1048576
  21. backup: true
  22. - name: Setup nproc for user
  23. become: true
  24. ansible.builtin.lineinfile:
  25. path: /etc/systemd/user.conf
  26. regexp: "^DefaultLimitNPROC"
  27. line: DefaultLimitNPROC=262144
  28. backup: true
  29. - name: Set user level ppen file limits for root
  30. become: true
  31. ansible.builtin.lineinfile:
  32. path: /etc/security/limits.conf
  33. line: root soft nofile 10240
  34. backup: true
  35. - name: Set user level open file limits for {{ ansible_user }}
  36. become: true
  37. lineinfile:
  38. path: /etc/security/limits.conf
  39. line: "{{ ansible_user }} soft nofile 10240"
  40. backup: true
  41. # https://docs.oracle.com/en/database/oracle/oracle-database/12.2/ladbi/changing-kernel-parameter-values.html#GUID-FB0CC366-61C9-4AA2-9BE7-233EB6810A31
  42. - name: Setup file max
  43. become: true
  44. lineinfile:
  45. path: "/etc/sysctl.d/100-fs.conf"
  46. state: present
  47. line: fs.file-max = 6815744
  48. create: true
  49. - name: Setup file max
  50. become: true
  51. lineinfile:
  52. path: "/etc/sysctl.d/100-fs.conf"
  53. state: present
  54. line: fs.inotify.max_user_watches = 512000
  55. create: true