From 0bbc3ed7f7e0eee1e157346a1a8320fa5c038fc9 Mon Sep 17 00:00:00 2001 From: ITQ Date: Mon, 12 Oct 2026 23:14:51 +0300 Subject: [PATCH] feat(roles/common): added nic offloads optmiziation --- group_vars/all/all.yaml | 3 +++ roles/common/handlers/main.yaml | 5 +++++ roles/common/tasks/optimization.yaml | 12 +++++++++++- roles/common/templates/nic-offloads.j2 | 3 +++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 roles/common/templates/nic-offloads.j2 diff --git a/group_vars/all/all.yaml b/group_vars/all/all.yaml index 6ab7c43..4cb6439 100644 --- a/group_vars/all/all.yaml +++ b/group_vars/all/all.yaml @@ -15,6 +15,9 @@ common_journal_retention_days: 21 common_journal_max_disk_limit: "5%" common_atop_retention_days: 3 +# Optimizations +enable_nic_offloads: false + # User management admin_users: - name: "{{ ansible_user }}" diff --git a/roles/common/handlers/main.yaml b/roles/common/handlers/main.yaml index 5bdd33e..89582da 100644 --- a/roles/common/handlers/main.yaml +++ b/roles/common/handlers/main.yaml @@ -7,3 +7,8 @@ - name: Reload systemd ansible.builtin.systemd: daemon_reload: true + +- name: Restart networking + ansible.builtin.service: + name: networking + state: restarted diff --git a/roles/common/tasks/optimization.yaml b/roles/common/tasks/optimization.yaml index d622a4f..12a57bf 100644 --- a/roles/common/tasks/optimization.yaml +++ b/roles/common/tasks/optimization.yaml @@ -43,7 +43,7 @@ notify: Reload systemd tags: optimization -- name: Enable and start GPU unbind servie +- name: Enable and start GPU unbind service become: true ansible.builtin.systemd: name: gpu-unbind-{{ item.label }} @@ -51,3 +51,13 @@ state: started loop: "{{ gpu_unbind_devices }}" tags: optimization + +- name: NIC offloads + when: enable_nic_offloads | bool + become: true + ansible.builtin.template: + src: nic-offloads.j2 + dest: /etc/network/if-up.d/{{ ansible_default_ipv4.interface }} + mode: "0755" + notify: Restart networking + tags: optimization diff --git a/roles/common/templates/nic-offloads.j2 b/roles/common/templates/nic-offloads.j2 new file mode 100644 index 0000000..00c10da --- /dev/null +++ b/roles/common/templates/nic-offloads.j2 @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +ethtool -K {{ ansible_default_ipv4.interface }} rx-udp-gro-forwarding on rx-gro-list off