From a2f532d60e2d0b90341718966d560402a276eebd Mon Sep 17 00:00:00 2001 From: Jeremy HERGAULT Date: Wed, 3 Dec 2025 11:46:05 +0100 Subject: [PATCH] feat: allow fd limit override for systemd service Signed-off-by: Jeremy HERGAULT --- .gitignore | 1 + .vscode/extensions.json | 6 ------ REFERENCE.md | 31 +++++++++++++++++++++++++++++++ manifests/init.pp | 6 ++++++ templates/service.epp | 4 ++++ 5 files changed, 42 insertions(+), 6 deletions(-) delete mode 100644 .vscode/extensions.json diff --git a/.gitignore b/.gitignore index 2803e56..e81ac17 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ .plan_cache.json .rerun.json bolt-debug.log +/.vscode/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index 6da8d47..0000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "recommendations": [ - "puppet.puppet-vscode", - "Shopify.ruby-lsp" - ] -} diff --git a/REFERENCE.md b/REFERENCE.md index 2fdea50..29fa42d 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -24,6 +24,10 @@ * [`ProSA::TelemetryLevel`](#ProSA--TelemetryLevel): A string that conforms to the ProSA `TelemetryLevel` syntax. +### Tasks + +* [`version`](#version): Gets the ProSA components versions + ## Classes ### `prosa` @@ -51,6 +55,7 @@ The following parameters are available in the `prosa` class: * [`service_enable`](#-prosa--service_enable) * [`service_manage`](#-prosa--service_manage) * [`service_ensure`](#-prosa--service_ensure) +* [`service_limit_nofile`](#-prosa--service_limit_nofile) * [`manage_user`](#-prosa--manage_user) * [`manage_group`](#-prosa--manage_group) * [`user`](#-prosa--user) @@ -136,6 +141,16 @@ application.
Default value: `'running'` +##### `service_limit_nofile` + +Data type: `Optional[Integer]` + +Sets the limit on the number of open file descriptors for the ProSA service.
+This parameter corresponds to the `LimitNOFILE` directive in the systemd service unit file.
+Apply the default system limit when set to `undef`. + +Default value: `undef` + ##### `manage_user` Data type: `Boolean` @@ -337,3 +352,19 @@ ProSA accept non case sensitive levels (like this type). Alias of `Pattern[/\A(?i:error|warn|info|debug|trace|off)\Z/]` +## Tasks + +### `version` + +Gets the ProSA components versions + +**Supports noop?** false + +#### Parameters + +##### `node_role` + +Data type: `String[1]` + +The role of the node joining the swarm + diff --git a/manifests/init.pp b/manifests/init.pp index e6ce65f..2806339 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -39,6 +39,11 @@ # to `false`, which is useful when you want to let the service be managed by another # application.
# +# @param service_limit_nofile +# Sets the limit on the number of open file descriptors for the ProSA service.
+# This parameter corresponds to the `LimitNOFILE` directive in the systemd service unit file.
+# Apply the default system limit when set to `undef`. +# # @param manage_user # When `false`, stops Puppet from creating the user resource.
# This is for instances when you have a user, created from another Puppet module, you want @@ -77,6 +82,7 @@ Boolean $service_enable = true, Boolean $service_manage = true, Variant[Stdlib::Ensure::Service, Boolean] $service_ensure = 'running', + Optional[Integer] $service_limit_nofile = undef, Boolean $manage_user = true, Boolean $manage_group = true, String $user = $prosa::params::user, diff --git a/templates/service.epp b/templates/service.epp index 23ac199..b493661 100644 --- a/templates/service.epp +++ b/templates/service.epp @@ -3,6 +3,7 @@ String $group = 'prosa', Stdlib::Absolutepath $bin_path = '/usr/local/bin/prosa', Stdlib::Absolutepath $conf_path = '/etc/prosa', + Optional[Integer] $limit_nofile = undef, | -%> [Unit] Description=ProSA service for <%= $prosa_name %> @@ -14,6 +15,9 @@ Type=simple User=<%= $user %> Group=<%= $group %> ExecStart=<%= $bin_path %> -c <%= $conf_path %> +<% if $limit_nofile { -%> +LimitNOFILE=<%= $limit_nofile %> +<% } -%> [Install] WantedBy=multi-user.target