From 15a29a66eccba8c13ffcb8a95c35d02d0c8abd51 Mon Sep 17 00:00:00 2001 From: nicoo Date: Mon, 17 Dec 2018 17:09:02 +0100 Subject: [PATCH] ansible/base: Add network tasks, set congestion control options --- ansible/roles/base/defaults/main.yml | 3 +++ ansible/roles/base/tasks/06net.yml | 29 +++++++++++++++++++++++++++++ ansible/roles/base/tasks/main.yml | 1 + 3 files changed, 33 insertions(+) create mode 100644 ansible/roles/base/tasks/06net.yml diff --git a/ansible/roles/base/defaults/main.yml b/ansible/roles/base/defaults/main.yml index ea08535..400e851 100644 --- a/ansible/roles/base/defaults/main.yml +++ b/ansible/roles/base/defaults/main.yml @@ -1 +1,4 @@ base_managed_ntpd: yes + +network_modules: + - tcp_bbr diff --git a/ansible/roles/base/tasks/06net.yml b/ansible/roles/base/tasks/06net.yml new file mode 100644 index 0000000..17a5950 --- /dev/null +++ b/ansible/roles/base/tasks/06net.yml @@ -0,0 +1,29 @@ +--- +- name: Configure to load network-related kernel modules + copy: + dest: /etc/modules-load.d/local-network.conf + content: '{{ network_modules | join("\n") }}' + +- name: Load network-related kernel modules + modprobe: + name: "{{ item }}" + with_items: "{{ network_modules }}" + +- name: Set network-related sysctl options + sysctl: + sysctl_file: /etc/sysctl.d/local-network.conf + sysctl_set: yes + name: "{{ item.key }}" + value: "{{ item.value }}" + + with_dict: + # CoDel (controlled delay) with Fair Queuing as the default queue scheduler + # mitigates bufferbloat and helps share bandwidth equitably across flows. + net.core.default_qdisc: fq_codel + + # BBR is currently the best TCP congestion control algorithm. + # C.f. https://queue.acm.org/detail.cfm?id=3022184 + net.ipv4.tcp_congestion_control: bbr + + loop_control: + label: "{{ item.key }}" diff --git a/ansible/roles/base/tasks/main.yml b/ansible/roles/base/tasks/main.yml index 1bf4243..cff0d6a 100644 --- a/ansible/roles/base/tasks/main.yml +++ b/ansible/roles/base/tasks/main.yml @@ -5,3 +5,4 @@ - when: ansible_service_mgr == "systemd" import_tasks: 04systemd.yml - import_tasks: 05tools.yml +- import_tasks: 06net.yml -- 1.7.10.4