From ec42c5a4486237a5bf821aa5493e7a5a60e8c8bb Mon Sep 17 00:00:00 2001 From: Jan Tomsa Date: Mon, 5 Aug 2024 23:16:24 +0200 Subject: [PATCH 1/2] make it possible to install sentinell independently; update MDs; rebase to current master --- README.md | 9 +++++++++ REFERENCE.md | 17 +++++++++++++++++ manifests/sentinel.pp | 12 ++++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 32e6fa48..c9438f01 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,15 @@ class { 'redis::sentinel': } ``` +If installation without redis-server is desired, set `require_redis` parameter to false, i.e +```puppet +class { 'redis::sentinel': + ... + require_redis => false, + ... +} +``` + ### Soft dependency When managing the repo, it needs [puppetlabs/apt](https://forge.puppet.com/puppetlabs/apt). diff --git a/REFERENCE.md b/REFERENCE.md index 2737c894..600d5d52 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -1509,6 +1509,15 @@ class {'redis::sentinel': } ``` +If installation without redis-server is desired, set `require_redis` parameter to false, i.e +```puppet +class { 'redis::sentinel': + ... + require_redis => false, + ... +} +``` + #### Parameters The following parameters are available in the `redis::sentinel` class: @@ -1908,6 +1917,14 @@ Data type: `Stdlib::Ensure::Service` Default value: `'running'` +##### `require_redis` + +Data type: `Boolean` + +Require redis base class. If set to false, sentinel is installed without redis server. + +Default value: `true` + ## Defined types ### `redis::instance` diff --git a/manifests/sentinel.pp b/manifests/sentinel.pp index 676ab6e0..33a15111 100644 --- a/manifests/sentinel.pp +++ b/manifests/sentinel.pp @@ -148,6 +148,9 @@ # log_file => '/var/log/redis/sentinel.log', # } # +# @param contain_redis +# Contain redis base class. If set to false, sentinel is installed without redis server. +# class redis::sentinel ( Optional[Variant[String[1], Sensitive[String[1]]]] $auth_pass = undef, Stdlib::Absolutepath $config_file = $redis::params::sentinel_config_file, @@ -191,6 +194,7 @@ Optional[Stdlib::Absolutepath] $notification_script = undef, Optional[Stdlib::Absolutepath] $client_reconfig_script = undef, Array[String[1]] $acls = [], + Boolean $contain_redis = true, ) inherits redis::params { $auth_pass_unsensitive = if $auth_pass =~ Sensitive { $auth_pass.unwrap @@ -198,13 +202,17 @@ $auth_pass } - contain 'redis' + if $contain_redis { + contain 'redis' + } if $package_name != $redis::package_name { stdlib::ensure_packages([$package_name], { ensure => $package_ensure }) - Package[$package_name] -> Class['redis'] + if $contain_redis { + Package[$package_name] -> Class['redis'] + } } Package[$package_name] -> File[$config_file_orig] From fa3d20da777728ee1702347ebf06c4266bde1b06 Mon Sep 17 00:00:00 2001 From: Jan Tomsa Date: Mon, 5 Aug 2024 23:23:51 +0200 Subject: [PATCH 2/2] rename require_redis to contain_redis to match the currently used option --- README.md | 4 ++-- REFERENCE.md | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c9438f01..669ce8b5 100644 --- a/README.md +++ b/README.md @@ -133,11 +133,11 @@ class { 'redis::sentinel': } ``` -If installation without redis-server is desired, set `require_redis` parameter to false, i.e +If installation without redis-server is desired, set `contain_redis` parameter to false, i.e ```puppet class { 'redis::sentinel': ... - require_redis => false, + contain_redis => false, ... } ``` diff --git a/REFERENCE.md b/REFERENCE.md index 600d5d52..63eb3427 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -1451,13 +1451,13 @@ Note that this class requires the herculesteam/augeasproviders_sysctl module. #### Examples -##### +##### ```puppet include redis::administration ``` -##### +##### ```puppet class {'redis::administration': @@ -1509,11 +1509,11 @@ class {'redis::sentinel': } ``` -If installation without redis-server is desired, set `require_redis` parameter to false, i.e +If installation without redis-server is desired, set `contain_redis` parameter to false, i.e ```puppet class { 'redis::sentinel': ... - require_redis => false, + contain_redis => false, ... } ``` @@ -1917,7 +1917,7 @@ Data type: `Stdlib::Ensure::Service` Default value: `'running'` -##### `require_redis` +##### `contain_redis` Data type: `Boolean` @@ -1934,7 +1934,7 @@ multiple redis instances on one machine without conflicts #### Examples -##### +##### ```puppet redis::instance {'6380':