Compare commits
4 commits
0a2171494c
...
ad1d2e2ffe
| Author | SHA1 | Date | |
|---|---|---|---|
| ad1d2e2ffe | |||
| 11b6273f42 | |||
| 184476e772 | |||
| 1c7e0ec61f |
3 changed files with 17 additions and 17 deletions
|
|
@ -16,23 +16,19 @@
|
||||||
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 Legacy sysctl.conf entfernen
|
- name: Verwaltete Werte aus konkurrierenden Sysctl-Quellen entfernen
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: /etc/sysctl.conf
|
path: "{{ item.0.item }}"
|
||||||
regexp: "^[ \\t]*{{ item.key | regex_escape }}[ \\t]*="
|
regexp: "^[ \\t]*{{ item.1.key | regex_escape }}[ \\t]*="
|
||||||
state: absent
|
state: absent
|
||||||
loop: "{{ sysctl_params }}"
|
loop: "{{ legacy_sysctl_files.results | product(sysctl_params) | list }}"
|
||||||
when: legacy_sysctl_files.results[0].stat.exists
|
loop_control:
|
||||||
|
label: "{{ item.0.item }}: {{ item.1.key }}"
|
||||||
- name: Verwaltete Werte aus Legacy 99-streaming.conf entfernen
|
when: item.0.stat.exists
|
||||||
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,7 +38,6 @@
|
||||||
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,4 +1,5 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import re
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
ROOT = Path(__file__).parents[1]
|
ROOT = Path(__file__).parents[1]
|
||||||
|
|
@ -17,6 +18,8 @@ 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)
|
||||||
|
|
||||||
|
|
@ -25,9 +28,11 @@ 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):
|
||||||
text = (ROOT / "roles/sysctl_proxmox/tasks/main.yml").read_text()
|
canonical = (ROOT / "roles/sysctl/defaults/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"):
|
proxmox = (ROOT / "roles/sysctl_proxmox/tasks/main.yml").read_text()
|
||||||
self.assertNotIn(key, text)
|
canonical_keys = set(re.findall(r"key:\s*([a-z0-9_.-]+)", canonical))
|
||||||
|
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