From 0f930aad8cfed622b66ce522f2186b35de127165 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 30 Mar 2021 13:51:37 +0200 Subject: [PATCH] Move ulimit management into the instance define This allows any service where the ulimit isn't in the service file to be managed via a drop in. --- manifests/instance.pp | 9 +++++++++ manifests/ulimit.pp | 8 +------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/manifests/instance.pp b/manifests/instance.pp index 901a2c9f..1b9c0b80 100644 --- a/manifests/instance.pp +++ b/manifests/instance.pp @@ -332,6 +332,15 @@ mode => '0644', content => template('redis/service_templates/redis.service.erb'), } + } else { + if $ulimit_managed { + systemd::service_limits { "${service_name}.service": + limits => { + 'LimitNOFILE' => $ulimit, + }, + restart_service => false, + } + } } $_real_log_file = $log_file ? { diff --git a/manifests/ulimit.pp b/manifests/ulimit.pp index 73012047..d3ac91d9 100644 --- a/manifests/ulimit.pp +++ b/manifests/ulimit.pp @@ -27,13 +27,7 @@ } } - systemd::service_limits { "${redis::service_name}.service": - limits => { - 'LimitNOFILE' => $redis::ulimit, - }, - restart_service => false, - } - + # Migrate from the old managed service file { "/etc/systemd/system/${redis::service_name}.service.d/limit.conf": ensure => absent, }