Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to install sentinel independently #389

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,15 @@ class { 'redis::sentinel':
}
```

If installation without redis-server is desired, set `contain_redis` parameter to false, i.e
```puppet
class { 'redis::sentinel':
...
contain_redis => false,
...
}
```

### Soft dependency

When managing the repo, it needs [puppetlabs/apt](https://forge.puppet.com/puppetlabs/apt).
Expand Down
23 changes: 20 additions & 3 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1451,13 +1451,13 @@ Note that this class requires the herculesteam/augeasproviders_sysctl module.

#### Examples

#####
#####

```puppet
include redis::administration
```

#####
#####

```puppet
class {'redis::administration':
Expand Down Expand Up @@ -1509,6 +1509,15 @@ class {'redis::sentinel':
}
```

If installation without redis-server is desired, set `contain_redis` parameter to false, i.e
```puppet
class { 'redis::sentinel':
...
contain_redis => false,
...
}
```

#### Parameters

The following parameters are available in the `redis::sentinel` class:
Expand Down Expand Up @@ -1899,6 +1908,14 @@ Data type: `Stdlib::Ensure::Service`

Default value: `'running'`

##### <a name="-redis--sentinel--contain_redis"></a>`contain_redis`

Data type: `Boolean`

Require redis base class. If set to false, sentinel is installed without redis server.

Default value: `true`

## Defined types

### <a name="redis--instance"></a>`redis::instance`
Expand All @@ -1908,7 +1925,7 @@ multiple redis instances on one machine without conflicts

#### Examples

#####
#####

```puppet
redis::instance {'6380':
Expand Down
14 changes: 11 additions & 3 deletions manifests/sentinel.pp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
# @param acls
# This is a way to pass an array of raw ACLs to Sentinel. The ACLs must be
# in the form of:
#
#
# user USERNAME [additional ACL options]
#
# @example Basic inclusion
Expand All @@ -145,6 +145,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,
Expand Down Expand Up @@ -187,20 +190,25 @@
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
} else {
$auth_pass
}

contain 'redis'
if $contain_redis {
contain 'redis'
}

if $package_name != $redis::package_name {
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]

Expand Down
Loading