- name: swappiness
  become: true
  sysctl:
    name: vm.swappiness
    value: 1
    sysctl_set: true
- name: net.ipv4.ip_forward
  become: true
  sysctl:
    name: net.ipv4.ip_forward
    value: 1
    sysctl_set: true
- name: fs.inotify.max_user_watches
  become: true
  sysctl:
    name: fs.inotify.max_user_watches
    value: 524288
    sysctl_set: true
- name: net.ipv4.conf.all.rp_filter
  become: true
  sysctl:
    name: net.ipv4.conf.all.rp_filter
    value: 0
    sysctl_set: true
- name: net.ipv4.conf.default.rp_filter
  become: true
  sysctl:
    name: net.ipv4.conf.default.rp_filter
    value: 0
    sysctl_set: true
- name: TCP BBR
  become: true
  sysctl:
    name: net.core.default_qdisc
    value: fq
    sysctl_set: true
  when: ansible_kernel.startswith("5.") or ansible_kernel.startswith("4.9.") or (ansible_kernel.startswith("4.1") and not ansible_kernel.startswith("4.1."))
- name: TCP BBR
  become: true
  sysctl:
    name: net.ipv4.tcp_congestion_control
    value: bbr
    sysctl_set: true
  when: ansible_kernel.startswith("5.") or ansible_kernel.startswith("4.9.") or (ansible_kernel.startswith("4.1") and not ansible_kernel.startswith("4.1."))
- name: limit
  become: true
  pam_limits:
    domain: '{{ item }}'
    limit_type: '-'
    limit_item: nofile
    value: 1048576
  with_items:
    - root
    - '{{ansible_user_id}}'
