Skip to content

Commit 767ef25

Browse files
authored
Merge pull request #551 from BjoernHelmbold/add_sentinel_auth
Add sentinel auth_user and auth_pass
2 parents ab6b99c + e8266ee commit 767ef25

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

REFERENCE.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,6 +1553,8 @@ The following parameters are available in the `redis::sentinel` class:
15531553
* [`working_dir`](#-redis--sentinel--working_dir)
15541554
* [`notification_script`](#-redis--sentinel--notification_script)
15551555
* [`client_reconfig_script`](#-redis--sentinel--client_reconfig_script)
1556+
* [`sentinel_auth_pass`](#-redis--sentinel--sentinel_auth_pass)
1557+
* [`sentinel_auth_user`](#-redis--sentinel--sentinel_auth_user)
15561558
* [`acls`](#-redis--sentinel--acls)
15571559
* [`service_ensure`](#-redis--sentinel--service_ensure)
15581560

@@ -1889,6 +1891,24 @@ Path to the client-reconfig script
18891891

18901892
Default value: `undef`
18911893

1894+
##### <a name="-redis--sentinel--sentinel_auth_pass"></a>`sentinel_auth_pass`
1895+
1896+
Data type: `Optional[Variant[String[1], Sensitive[String[1]]]]`
1897+
1898+
The password that Sentinels use to authenticate with each other.
1899+
This is needed for Redis 7 with ACLs enabled.
1900+
1901+
Default value: `undef`
1902+
1903+
##### <a name="-redis--sentinel--sentinel_auth_user"></a>`sentinel_auth_user`
1904+
1905+
Data type: `Optional[String[1]]`
1906+
1907+
The username that Sentinels use to authenticate with each other.
1908+
This is needed for Redis 7 with ACLs enabled.
1909+
1910+
Default value: `undef`
1911+
18921912
##### <a name="-redis--sentinel--acls"></a>`acls`
18931913

18941914
Data type: `Array[String[1]]`

manifests/sentinel.pp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@
133133
# @param client_reconfig_script
134134
# Path to the client-reconfig script
135135
#
136+
# @param sentinel_auth_pass
137+
# The password that Sentinels use to authenticate with each other.
138+
# This is needed for Redis 7 with ACLs enabled.
139+
#
140+
# @param sentinel_auth_user
141+
# The username that Sentinels use to authenticate with each other.
142+
# This is needed for Redis 7 with ACLs enabled.
143+
#
136144
# @param acls
137145
# This is a way to pass an array of raw ACLs to Sentinel. The ACLs must be
138146
# in the form of:
@@ -190,6 +198,8 @@
190198
Stdlib::Absolutepath $working_dir = $redis::params::sentinel_working_dir,
191199
Optional[Stdlib::Absolutepath] $notification_script = undef,
192200
Optional[Stdlib::Absolutepath] $client_reconfig_script = undef,
201+
Optional[Variant[String[1], Sensitive[String[1]]]] $sentinel_auth_pass = undef,
202+
Optional[String[1]] $sentinel_auth_user = undef,
193203
Array[String[1]] $acls = [],
194204
) inherits redis::params {
195205
$auth_pass_unsensitive = if $auth_pass =~ Sensitive {

spec/classes/redis_sentinel_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ class { 'redis':
130130
tls_ca_cert_dir: '/etc/pki/cacerts',
131131
tls_auth_clients: 'yes',
132132
tls_replication: true,
133+
sentinel_auth_user: 'default',
134+
sentinel_auth_pass: '4321'
133135
}
134136
end
135137

@@ -144,6 +146,9 @@ class { 'redis':
144146
pidfile #{pidfile}
145147
protected-mode no
146148
149+
sentinel sentinel-user default
150+
sentinel sentinel-pass 4321
151+
147152
sentinel announce-hostnames yes
148153
sentinel announce-ip myhostnameOrIP
149154
sentinel announce-port 1234

templates/redis-sentinel.conf.erb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ daemonize <%= @daemonize ? 'yes' : 'no' %>
1010
supervised auto
1111
pidfile <%= @pid_file %>
1212
protected-mode <%= @protected_mode ? 'yes' : 'no' %>
13+
<% if @sentinel_auth_user -%>
14+
15+
sentinel sentinel-user <%= @sentinel_auth_user %>
16+
<% end -%>
17+
<% if @sentinel_auth_pass -%>
18+
sentinel sentinel-pass <%= @sentinel_auth_pass %>
19+
<% end -%>
1320

1421
<% if @sentinel_announce_hostnames -%>
1522
sentinel announce-hostnames <%= @sentinel_announce_hostnames %>

0 commit comments

Comments
 (0)