diff --git a/REFERENCE.md b/REFERENCE.md
index 0902d2e5..3518eed9 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -200,6 +200,11 @@ The following parameters are available in the `redis` class:
* [`unixsocketperm`](#-redis--unixsocketperm)
* [`workdir`](#-redis--workdir)
* [`workdir_mode`](#-redis--workdir_mode)
+* [`workdir_group`](#-redis--workdir_group)
+* [`workdir_owner`](#-redis--workdir_owner)
+* [`debdefault_group`](#-redis--debdefault_group)
+* [`debdefault_file_mode`](#-redis--debdefault_file_mode)
+* [`debdefault_owner`](#-redis--debdefault_owner)
* [`zset_max_ziplist_entries`](#-redis--zset_max_ziplist_entries)
* [`zset_max_ziplist_value`](#-redis--zset_max_ziplist_value)
* [`cluster_enabled`](#-redis--cluster_enabled)
@@ -1161,6 +1166,49 @@ Adjust mode for data directory.
Default value: `'0750'`
+##### `workdir_group`
+
+Data type: `Optional[String[1]]`
+
+Adjust filesystem group for $workdir.
+
+Default value: `undef`
+
+##### `workdir_owner`
+
+Data type: `Optional[String[1]]`
+
+Adjust filesystem owner for $workdir.
+
+Default value: `undef`
+
+##### `debdefault_group`
+
+Data type: `Optional[String[1]]`
+
+group of /etc/defaults/redis on Debian systems
+if undef, $redis::config_group is taken
+
+Default value: `undef`
+
+##### `debdefault_file_mode`
+
+Data type: `Optional[Stdlib::Filemode]`
+
+filemode of /etc/defaults/redis on Debian systems
+if undef, $redis::config_file_mode is taken
+
+Default value: `undef`
+
+##### `debdefault_owner`
+
+Data type: `Optional[String[1]]`
+
+owner of /etc/defaults/redis on Debian systems
+if undef, $redis::config_owner is taken
+
+Default value: `undef`
+
##### `zset_max_ziplist_entries`
Data type: `Integer[0]`
diff --git a/manifests/config.pp b/manifests/config.pp
index beedbdc7..fd6ff590 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -21,9 +21,9 @@
file { $redis::workdir:
ensure => directory,
- group => $redis::service_group,
+ group => pick($redis::workdir_group, $redis::service_group),
mode => $redis::workdir_mode,
- owner => $redis::service_user,
+ owner => pick($redis::workdir_owner, $redis::service_user),
}
if $redis::default_install {
@@ -48,9 +48,9 @@
'Debian': {
file { '/etc/default/redis-server':
ensure => file,
- group => $redis::config_group,
- mode => $redis::config_file_mode,
- owner => $redis::config_owner,
+ group => pick($redis::debdefault_group, $redis::config_group),
+ mode => pick($redis::debdefault_file_mode, $redis::config_file_mode),
+ owner => pick($redis::debdefault_owner, $redis::config_owner),
}
}
diff --git a/manifests/init.pp b/manifests/init.pp
index 0de065df..076d2577 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -263,6 +263,19 @@
# above using the 'dbfilename' configuration directive.
# @param workdir_mode
# Adjust mode for data directory.
+# @param workdir_group
+# Adjust filesystem group for $workdir.
+# @param workdir_owner
+# Adjust filesystem owner for $workdir.
+# @param debdefault_group
+# group of /etc/defaults/redis on Debian systems
+# if undef, $redis::config_group is taken
+# @param debdefault_file_mode
+# filemode of /etc/defaults/redis on Debian systems
+# if undef, $redis::config_file_mode is taken
+# @param debdefault_owner
+# owner of /etc/defaults/redis on Debian systems
+# if undef, $redis::config_owner is taken
# @param zset_max_ziplist_entries
# Set max entries for sorted sets.
# @param zset_max_ziplist_value
@@ -455,6 +468,11 @@
Boolean $ulimit_managed = true,
Stdlib::Absolutepath $workdir = $redis::params::workdir,
Stdlib::Filemode $workdir_mode = '0750',
+ Optional[String[1]] $workdir_group = undef,
+ Optional[String[1]] $workdir_owner = undef,
+ Optional[String[1]] $debdefault_group = undef,
+ Optional[Stdlib::Filemode] $debdefault_file_mode = undef,
+ Optional[String[1]] $debdefault_owner = undef,
Integer[0] $zset_max_ziplist_entries = 128,
Integer[0] $zset_max_ziplist_value = 64,
Boolean $cluster_enabled = false,
diff --git a/spec/classes/redis_spec.rb b/spec/classes/redis_spec.rb
index 6d72a062..4cc989d4 100644
--- a/spec/classes/redis_spec.rb
+++ b/spec/classes/redis_spec.rb
@@ -1715,6 +1715,63 @@ class { 'redis':
it { is_expected.to contain_systemd__unit_file("#{service_name}.service").with('content' => %r{^TimeoutStartSec=600$}) }
it { is_expected.to contain_systemd__unit_file("#{service_name}.service").with('content' => %r{^TimeoutStopSec=300$}) }
end
+
+ describe 'with non default ownership' do
+ let :params do
+ {
+ workdir: '/tmp/rediswork',
+ workdir_group: 'wdirgroup',
+ workdir_owner: 'wdirowner',
+ config_group: 'cfggroup',
+ }
+ end
+
+ it {
+ is_expected.to contain_file('/tmp/rediswork').with(
+ 'ensure' => 'directory',
+ 'owner' => 'wdirowner',
+ 'group' => 'wdirgroup',
+ 'mode' => '0750'
+ )
+ }
+
+ if facts[:os]['family'] == 'Debian'
+ it {
+ is_expected.to contain_file('/etc/default/redis-server').
+ with(
+ 'ensure' => 'file',
+ 'owner' => 'redis',
+ 'group' => 'cfggroup',
+ 'mode' => '0640'
+ )
+ }
+ end
+ end
+
+ describe 'overwrite debian directory config' do
+ let :params do
+ {
+ config_owner: 'redis',
+ config_group: 'cfggroup',
+ config_file_mode: '0333',
+ debdefault_group: 'dd_group',
+ debdefault_owner: 'dd_owner',
+ debdefault_file_mode: '0242',
+ }
+ end
+
+ if facts[:os]['family'] == 'Debian'
+ it {
+ is_expected.to contain_file('/etc/default/redis-server').
+ with(
+ 'ensure' => 'file',
+ 'owner' => 'dd_owner',
+ 'group' => 'dd_group',
+ 'mode' => '0242'
+ )
+ }
+ end
+ end
end
end
end