From da1ad3f6db810b68acf5862351e4b2c19e1f0261 Mon Sep 17 00:00:00 2001
From: Evangelos Foutras <evangelos@foutrelis.com>
Date: Fri, 21 Apr 2017 08:06:49 +0300
Subject: [PATCH] common: allow configuring default qdisc

BBR needs to be used with the fq qdisc, so allow configuring the default
qdisc and set it to "fq" on soyuz (switched to BBR in a previous commit).
---
 host_vars/soyuz.archlinux.org |  1 +
 roles/common/tasks/main.yml   | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/host_vars/soyuz.archlinux.org b/host_vars/soyuz.archlinux.org
index d87360870..296072d94 100644
--- a/host_vars/soyuz.archlinux.org
+++ b/host_vars/soyuz.archlinux.org
@@ -6,5 +6,6 @@ ipv6_address: "2a01:4f8:173:1654::1"
 ipv6_netmask: "/128"
 ipv4_gateway: "138.201.206.65"
 ipv6_gateway: "fe80::1"
+default_qdisc: "fq"
 tcp_congestion_control: "bbr"
 filesystem: btrfs
diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml
index 5dd45a9df..8c78f27b5 100644
--- a/roles/common/tasks/main.yml
+++ b/roles/common/tasks/main.yml
@@ -35,11 +35,24 @@
   notify:
     - restart networkd
 
+- name: configure default qdisc
+  sysctl:
+    name: net.core.default_qdisc
+    value: "{{default_qdisc}}"
+    sysctl_file: /etc/sysctl.d/net.conf
+  when: default_qdisc is defined
+
+- name: apply default qdisc to interfaces
+  command: tc qdisc replace dev {{item}} root {{default_qdisc}}
+  with_items: "{{ansible_interfaces | difference('lo')}}"
+  when: default_qdisc is defined
+
 - name: configure tcp congestion control algorithm
   sysctl:
     name: net.ipv4.tcp_congestion_control
     value: "{{tcp_congestion_control}}"
-    sysctl_file: /etc/sysctl.d/local.conf
+    sysctl_set: yes
+    sysctl_file: /etc/sysctl.d/net.conf
   when: tcp_congestion_control is defined
 
 - name: configure journald
-- 
GitLab