From f0d8ab72dab51b4853d597f4c34669d76aadd7b3 Mon Sep 17 00:00:00 2001 From: Antsiferov Grigory Date: Tue, 19 Sep 2017 09:56:31 +0300 Subject: [PATCH] Add sysctl states for vm, fs and some kernel params. --- sls/sysctl/fs.sls | 11 +++++++++++ sls/sysctl/kernel.sls | 11 +++++++++++ sls/sysctl/vm.sls | 27 +++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 sls/sysctl/fs.sls create mode 100644 sls/sysctl/kernel.sls create mode 100644 sls/sysctl/vm.sls diff --git a/sls/sysctl/fs.sls b/sls/sysctl/fs.sls new file mode 100644 index 0000000..1e8e046 --- /dev/null +++ b/sls/sysctl/fs.sls @@ -0,0 +1,11 @@ +{% set fs = salt['pillar.get']('sysctl:fs', {}) %} + +fs.file-max: + sysctl.present: + - config: '/etc/sysctl.d/fs.conf' + - value: {{ fs.get('file-max', 1000000) }} + +fs.inotify.max_user_watches: + sysctl.present: + - config: '/etc/sysctl.d/fs.conf' + - value: {{ fs.get('inotify.max_user_watches', 100000) }} diff --git a/sls/sysctl/kernel.sls b/sls/sysctl/kernel.sls new file mode 100644 index 0000000..dc100e2 --- /dev/null +++ b/sls/sysctl/kernel.sls @@ -0,0 +1,11 @@ +kernel.pid_max: + sysctl.present: + - value: 999999 + +kernel.panic: + sysctl.present: + - value : 30 + +kernel.sched_migration_cost_ns: + sysctl.present: + - value: 5000000 diff --git a/sls/sysctl/vm.sls b/sls/sysctl/vm.sls new file mode 100644 index 0000000..e84b630 --- /dev/null +++ b/sls/sysctl/vm.sls @@ -0,0 +1,27 @@ +{% set vm = salt['pillar.get']('sysctl:vm', {}) %} + +vm.swappiness: + sysctl.present: + - config: '/etc/sysctl.d/vm.conf' + - value: {{ vm.get('swappiness', 0) }} + +vm.zone_reclaim_mode: + sysctl.present: + - config: '/etc/sysctl.d/vm.conf' + - value: {{ vm.get('zone_reclaim_mode', 0) }} + +vm.dirty_bytes: + sysctl.present: + - config: '/etc/sysctl.d/vm.conf' + - value: {{ vm.get('dirty_bytes', 33554432) }} + +vm.dirty_background_bytes: + sysctl.present: + - config: '/etc/sysctl.d/vm.conf' + - value: {{ vm.get('dirty_background_bytes', 8388608) }} + +vm.min_free_kbytes: + sysctl.present: + - config: '/etc/sysctl.d/vm.conf' + - value: {{ vm.get('min_free_kbytes', 262144) }} +