diff --git a/roles/core/sysctl/files/sysctl.conf b/roles/core/sysctl/files/sysctl.conf index 1f2a285..86819ff 100644 --- a/roles/core/sysctl/files/sysctl.conf +++ b/roles/core/sysctl/files/sysctl.conf @@ -1,22 +1,35 @@ # ------------------------------------------------------------- # Kernel state configuration # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Project: Nasqueron # Created: 2017-11-06 # License: Trivial work, not eligible to copyright # Source file: roles/core/sysctl/files/sysctl.conf # ------------------------------------------------------------- # # # This file is managed by our rOPS SaltStack repository. # # Changes to this file may cause incorrect behavior # and will be lost if the state is redeployed. # # ------------------------------------------------------------- # VFS — kernel interface to file systems # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Allow user to mount disks (required by FUSE or PEFS) vfs.usermount=1 + +{% if use_zfs %} + +{% if mem < 4096 %} +# Maximum size of the Adaptive Replacement Cache (ARC). +vfs.zfs.arc_max = 2147483648 +{% endif %} + +# Keep prefetch: this works by reading larger blocks than were requested +# into the ARC in hopes that the data will be needed soon. +vfs.zfs.prefetch_disable=0 + +{% endif %} diff --git a/roles/core/sysctl/init.sls b/roles/core/sysctl/init.sls index 2802124..9410121 100644 --- a/roles/core/sysctl/init.sls +++ b/roles/core/sysctl/init.sls @@ -1,16 +1,22 @@ # ------------------------------------------------------------- # Salt — Kernel state # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Project: Nasqueron # Created: 2017-11-06 # License: Trivial work, not eligible to copyright # # ------------------------------------------------------------- {% if grains['os'] == 'FreeBSD' %} +{% set use_zfs = salt['node.has']('zfs:pool') %} + /etc/sysctl.conf: file.managed: - source: salt://roles/core/sysctl/files/sysctl.conf + - template: jinja + - context: + use_zfs: {{ use_zfs }} + mem: {{ grains['mem_total'] }} {% endif %}