ansible: 将 TCP 拥塞控制算法切换到 BBR 提取成一个 role

This commit is contained in:
zedhugh committed 2026-10-06 02:42:13 +08:00
1 parent d3dc97ad2b
commit a6f134eada
8 files changed
+68 -7

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
---
- name: 获取可用的 TCP 拥塞控制算法列表
command: sysctl net.ipv4.tcp_available_congestion_control
register: available_cc
changed_when: false
- name: 确认 bbr 在可用列表中
fail:
msg: "BBR 不在可用的 TCP 拥塞控制算法列表中"
when: "'bbr' not in available_cc.stdout"
- name: 验证当前拥塞控制算法
command: sysctl net.ipv4.tcp_congestion_control
register: current_cc
changed_when: false
- name: 打印当前 TCP 拥塞控制算法
debug:
msg: "当前 TPC 拥塞控制算法: {{ current_cc.stdout }}"