From 8bdcc96a365c28de32dbc8f7f2e63511d25e0172 Mon Sep 17 00:00:00 2001 From: Someone Date: Fri, 4 Oct 2024 13:42:33 +0200 Subject: [PATCH] [roles/base/sysctl] Set system settings - TODO: move to systemd subrole? --- roles/base/sysctl/files/default/sysctl.conf | 23 +++++++++++++++++++++ roles/base/sysctl/handlers/main.yml | 10 +++++++++ roles/base/sysctl/tasks/main.yml | 17 +++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 roles/base/sysctl/files/default/sysctl.conf create mode 100644 roles/base/sysctl/handlers/main.yml create mode 100644 roles/base/sysctl/tasks/main.yml diff --git a/roles/base/sysctl/files/default/sysctl.conf b/roles/base/sysctl/files/default/sysctl.conf new file mode 100644 index 0000000..adddca0 --- /dev/null +++ b/roles/base/sysctl/files/default/sysctl.conf @@ -0,0 +1,23 @@ +# +################################################ +### Managed by someone's ansible provisioner ### +################################################ +# Part of: https://git.somenet.org/root/pub/somesible.git +# 2017-2024 by someone +# + +# reboot after 5 sec +kernel.panic = 5 + +# spam consoles +#kernel.printk=7 + +# more shared mem +kernel.shmmax=268435456 + +# reduce swapping +vm.swappiness = 2 + +# slow raid resync from 200000 to... (only applies to md-raid) +dev.raid.speed_limit_min=40000 +dev.raid.speed_limit_max=40000 diff --git a/roles/base/sysctl/handlers/main.yml b/roles/base/sysctl/handlers/main.yml new file mode 100644 index 0000000..39c8fab --- /dev/null +++ b/roles/base/sysctl/handlers/main.yml @@ -0,0 +1,10 @@ +##################################### +### someone's ansible provisioner ### +##################################### +# Part of: https://git.somenet.org/root/pub/somesible.git +# 2017-2024 by someone +# +--- +- name: reload sysctl settings + command: sysctl --system + ignore_errors: yes diff --git a/roles/base/sysctl/tasks/main.yml b/roles/base/sysctl/tasks/main.yml new file mode 100644 index 0000000..98bd7b3 --- /dev/null +++ b/roles/base/sysctl/tasks/main.yml @@ -0,0 +1,17 @@ +##################################### +### someone's ansible provisioner ### +##################################### +# Part of: https://git.somenet.org/root/pub/somesible.git +# 2017-2024 by someone +# +--- +- name: copy/overwrite sysctl.conf + copy: + src: "{{item}}" + dest: "/etc/sysctl.conf" + with_first_found: + - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/sysctl.conf" + - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/sysctl.conf" + - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/sysctl.conf" + - "default/sysctl.conf" + notify: reload sysctl settings -- 2.43.0