Compare commits
No commits in common. "master" and "fix/canonical-wireguard-sysctl" have entirely different histories.
master
...
fix/canoni
3 changed files with 17 additions and 17 deletions
|
|
@ -16,19 +16,23 @@
|
||||||
loop:
|
loop:
|
||||||
- /etc/sysctl.conf
|
- /etc/sysctl.conf
|
||||||
- /etc/sysctl.d/99-streaming.conf
|
- /etc/sysctl.d/99-streaming.conf
|
||||||
- /etc/sysctl.d/99-proxmox-tuning.conf
|
|
||||||
- /etc/sysctl.d/99-zzz-cloudflare-warp-connector.conf
|
|
||||||
register: legacy_sysctl_files
|
register: legacy_sysctl_files
|
||||||
|
|
||||||
- name: Verwaltete Werte aus konkurrierenden Sysctl-Quellen entfernen
|
- name: Verwaltete Werte aus Legacy sysctl.conf entfernen
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: "{{ item.0.item }}"
|
path: /etc/sysctl.conf
|
||||||
regexp: "^[ \\t]*{{ item.1.key | regex_escape }}[ \\t]*="
|
regexp: "^[ \\t]*{{ item.key | regex_escape }}[ \\t]*="
|
||||||
state: absent
|
state: absent
|
||||||
loop: "{{ legacy_sysctl_files.results | product(sysctl_params) | list }}"
|
loop: "{{ sysctl_params }}"
|
||||||
loop_control:
|
when: legacy_sysctl_files.results[0].stat.exists
|
||||||
label: "{{ item.0.item }}: {{ item.1.key }}"
|
|
||||||
when: item.0.stat.exists
|
- name: Verwaltete Werte aus Legacy 99-streaming.conf entfernen
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: /etc/sysctl.d/99-streaming.conf
|
||||||
|
regexp: "^[ \\t]*{{ item.key | regex_escape }}[ \\t]*="
|
||||||
|
state: absent
|
||||||
|
loop: "{{ sysctl_params }}"
|
||||||
|
when: legacy_sysctl_files.results[1].stat.exists
|
||||||
|
|
||||||
- name: Sysctl Parameter kanonisch setzen
|
- name: Sysctl Parameter kanonisch setzen
|
||||||
ansible.posix.sysctl:
|
ansible.posix.sysctl:
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@
|
||||||
state: present
|
state: present
|
||||||
loop:
|
loop:
|
||||||
- { key: vm.overcommit_memory, value: "1" }
|
- { key: vm.overcommit_memory, value: "1" }
|
||||||
|
- { key: vm.swappiness, value: "1" }
|
||||||
- { key: fs.file-max, value: "9999999" }
|
- { key: fs.file-max, value: "9999999" }
|
||||||
- { key: fs.inotify.max_user_watches, value: "524288" }
|
- { key: fs.inotify.max_user_watches, value: "524288" }
|
||||||
- { key: fs.inotify.max_user_instances, value: "512" }
|
- { key: fs.inotify.max_user_instances, value: "512" }
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import re
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
ROOT = Path(__file__).parents[1]
|
ROOT = Path(__file__).parents[1]
|
||||||
|
|
@ -18,8 +17,6 @@ class SysctlRoleContract(unittest.TestCase):
|
||||||
text = (ROOT / "roles/sysctl/tasks/main.yml").read_text()
|
text = (ROOT / "roles/sysctl/tasks/main.yml").read_text()
|
||||||
self.assertIn("/etc/sysctl.conf", text)
|
self.assertIn("/etc/sysctl.conf", text)
|
||||||
self.assertIn("/etc/sysctl.d/99-streaming.conf", text)
|
self.assertIn("/etc/sysctl.d/99-streaming.conf", text)
|
||||||
self.assertIn("/etc/sysctl.d/99-proxmox-tuning.conf", text)
|
|
||||||
self.assertIn("/etc/sysctl.d/99-zzz-cloudflare-warp-connector.conf", text)
|
|
||||||
self.assertIn("state: absent", text)
|
self.assertIn("state: absent", text)
|
||||||
self.assertIn("regex_escape", text)
|
self.assertIn("regex_escape", text)
|
||||||
|
|
||||||
|
|
@ -28,11 +25,9 @@ class SysctlRoleContract(unittest.TestCase):
|
||||||
self.assertLess(play.index("- sysctl\n"), play.index("- sysctl_proxmox"))
|
self.assertLess(play.index("- sysctl\n"), play.index("- sysctl_proxmox"))
|
||||||
|
|
||||||
def test_proxmox_role_does_not_duplicate_canonical_network_keys(self):
|
def test_proxmox_role_does_not_duplicate_canonical_network_keys(self):
|
||||||
canonical = (ROOT / "roles/sysctl/defaults/main.yml").read_text()
|
text = (ROOT / "roles/sysctl_proxmox/tasks/main.yml").read_text()
|
||||||
proxmox = (ROOT / "roles/sysctl_proxmox/tasks/main.yml").read_text()
|
for key in ("net.core.rmem_max", "net.core.wmem_max", "net.ipv4.tcp_rmem", "net.ipv4.tcp_wmem", "net.ipv4.tcp_mtu_probing"):
|
||||||
canonical_keys = set(re.findall(r"key:\s*([a-z0-9_.-]+)", canonical))
|
self.assertNotIn(key, text)
|
||||||
proxmox_keys = set(re.findall(r"key:\s*([a-z0-9_.-]+)", proxmox))
|
|
||||||
self.assertEqual(canonical_keys & proxmox_keys, set())
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue