---

# Reasons for noqa: 1. Tabs can increase readability;
#                   2. The example in man limits.conf is tab formatted;
#                   3. It is difficult to replace tabs by spaces for entries for which their lenghts are not known
- name: Set the hard and soft limit for the max number of open files per process (nofile) to 1048576
        for group 'sapsys' # noqa no-tabs
  lineinfile:
    path: /etc/security/limits.d/99-sap.conf
    create: yes
    mode: 0644
    regexp: '^@sapsys\s+{{ line_item }}\s+nofile\s.*'
    line: "@sapsys\t{{ line_item }}\tnofile\t1048576"
  with_items:
    - hard
    - soft
  loop_control:
    loop_var: line_item

# Reasons for noqa: 1. Tabs can increase readability;
#                   2. The example in man limits.conf is tab formatted;
#                   3. It is difficult to replace tabs by spaces for entries for which their lenghts are not known
- name: Set the hard and soft limit for the max number of open files per process (nofile) to 1048576
        for group '{{ sap_preconfigure_db_group_name }}' # noqa no-tabs
  lineinfile:
    path: /etc/security/limits.d/99-sap.conf
    create: yes
    mode: 0644
    regexp: '^@{{ sap_preconfigure_db_group_name }}\s+{{ line_item }}\s+nofile\s.*'
    line: "@{{ sap_preconfigure_db_group_name }}\t{{ line_item }}\tnofile\t1048576"
  with_items:
    - hard
    - soft
  loop_control:
    loop_var: line_item
  when:
    - sap_preconfigure_db_group_name is defined
