--- # Host-level service and network tuning. - name: "Exclude p4d and p4broker from automatic restart on package changes" ansible.builtin.copy: src: "./policy-rc.d" dest: "/usr/sbin/policy-rc.d" owner: "root" group: "root" # policy-rc.d must be executable to be honoured by invoke-rc.d. mode: '0755' # The bbr congestion control set below needs the tcp_bbr module. On Debian/Ubuntu # kernels it is built-in or autoloads; on RedHat-family hosts load and persist it # explicitly so "sysctl --system" can apply the setting without error. - name: "Ensure /etc/modules-load.d exists (RedHat)" ansible.builtin.file: path: "/etc/modules-load.d" state: directory owner: "root" group: "root" mode: '0755' when: ansible_facts["os_family"] == "RedHat" - name: "Persist tcp_bbr module across reboots (RedHat)" ansible.builtin.copy: content: "tcp_bbr\n" dest: "/etc/modules-load.d/tcp_bbr.conf" owner: "root" group: "root" mode: '0644' when: ansible_facts["os_family"] == "RedHat" - name: "Load tcp_bbr module (RedHat)" community.general.modprobe: name: "tcp_bbr" state: "present" when: ansible_facts["os_family"] == "RedHat" - name: "Add recommended network tuning to sysctl.d" ansible.builtin.blockinfile: path: "/etc/sysctl.d/99-perforce.conf" create: true insertafter: "EOF" mode: '0644' block: | net.ipv4.tcp_congestion_control = bbr net.ipv4.tcp_window_scaling = 1 # allow testing with buffers up to 128MB net.core.rmem_max = 62500000 net.core.wmem_max = 62500000 # increase Linux autotuning TCP buffer limit to 64MB net.ipv4.tcp_rmem = 4096 87380 62500000 net.ipv4.tcp_wmem = 4096 16384 62500000 # recommended for hosts with jumbo frames enabled net.ipv4.tcp_mtu_probing = 1 # recommended to enable 'fair queueing' net.core.default_qdisc = fq notify: "Restart sysctl"