---

- name: Set sysctl limits for high tcp load
  sysctl:
    name: "{{ item.name }}"
    value: "{{ item.value }}"
    state: present
  with_items:
    - { name: "net.netfilter.nf_conntrack_max ", value: "{{ system_nf_conntrack_max }}" }
    - { name: "net.core.netdev_max_backlog", value: "{{ system_netdev_max_backlog }}" }
    - { name: "net.ipv4.ip_local_port_range", value: "{{ system_ip_local_port_range }}" }
    - { name: "net.core.rmem_max", value: "{{ system_net_rmem_max }}" }
    - { name: "net.core.wmem_max", value: "{{ system_net_wmem_max }}" }
    - { name: "net.core.rmem_default", value: "{{ system_net_rmem_default }}" }
    - { name: "net.core.wmem_default", value: "{{ system_net_wmem_default }}" }
    - { name: "net.ipv4.tcp_max_syn_backlog", value: "{{ system_tcp_max_syn_backlog }}" }
    - { name: "net.ipv4.tcp_syncookies", value: "{{ system_tcp_syncookies }}" }
    - { name: "net.ipv4.tcp_rmem", value: "{{ system_tcp_rmem }}" }
    - { name: "net.ipv4.tcp_wmem", value: "{{ system_tcp_wmem }}" }
    - { name: "net.ipv4.tcp_mem", value: "{{ system_tcp_mem }}" }
    - { name: "net.core.somaxconn", value: "{{ system_somaxconn }}" }
  tags: tcp-highload
  become: yes

