Skip to content

Commit 8673363

Browse files
committed
convert sentinel.conf template to epp
1 parent 5a0b1d5 commit 8673363

File tree

4 files changed

+79
-80
lines changed

4 files changed

+79
-80
lines changed

REFERENCE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ Data type: `String[1]`
16101610

16111611
Define which template to use.
16121612

1613-
Default value: `'redis/redis-sentinel.conf.erb'`
1613+
Default value: `'redis/redis-sentinel.conf.epp'`
16141614

16151615
##### <a name="-redis--sentinel--daemonize"></a>`daemonize`
16161616

manifests/sentinel.pp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
Stdlib::Absolutepath $config_file = $redis::params::sentinel_config_file,
165165
Stdlib::Absolutepath $config_file_orig = $redis::params::sentinel_config_file_orig,
166166
Stdlib::Filemode $config_file_mode = '0644',
167-
String[1] $conf_template = 'redis/redis-sentinel.conf.erb',
167+
String[1] $conf_template = 'redis/redis-sentinel.conf.epp',
168168
Boolean $daemonize = $redis::params::sentinel_daemonize,
169169
Boolean $protected_mode = true,
170170
Integer[1] $down_after = 30000,
@@ -224,14 +224,12 @@
224224
}
225225
Package[$package_name] -> File[$config_file_orig]
226226

227-
$sentinel_bind_arr = delete_undef_values([$sentinel_bind].flatten)
228-
229227
file { $config_file_orig:
230228
ensure => file,
231229
owner => $service_user,
232230
group => $service_group,
233231
mode => $config_file_mode,
234-
content => template($conf_template),
232+
content => epp($conf_template),
235233
}
236234

237235
exec { "cp -p ${config_file_orig} ${config_file}":

templates/redis-sentinel.conf.epp

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<%# THIS FILE IS MANAGED BY PUPPET -%>
2+
<% if $redis::sentinel::sentinel_bind { -%>
3+
bind <%= [$redis::sentinel::sentinel_bind].flatten.join(' ') %>
4+
<%- } -%>
5+
port <%= $redis::sentinel::sentinel_port %>
6+
<% if $redis::sentinel::sentinel_tls_port { -%>
7+
tls-port <%= $redis::sentinel::sentinel_tls_port %>
8+
<%- } -%>
9+
dir <%= $redis::sentinel::working_dir %>
10+
daemonize <%= $redis::sentinel::daemonize ? { true => 'yes', false => 'no' } %>
11+
supervised auto
12+
pidfile <%= $redis::sentinel::pid_file %>
13+
protected-mode <%= $redis::sentinel::protected_mode ? { true => 'yes', false => 'no' } %>
14+
15+
<% if $redis::sentinel::sentinel_auth_user { -%>
16+
sentinel sentinel-user <%= $redis::sentinel::sentinel_auth_user %>
17+
<%- } -%>
18+
<% if $redis::sentinel::sentinel_auth_pass { -%>
19+
sentinel sentinel-pass <%= $redis::sentinel::sentinel_auth_pass.unwrap %>
20+
21+
<%- } -%>
22+
<% if $redis::sentinel::sentinel_announce_hostnames { -%>
23+
sentinel announce-hostnames <%= $redis::sentinel::sentinel_announce_hostnames %>
24+
<%- } -%>
25+
<% if $redis::sentinel::sentinel_announce_ip { -%>
26+
sentinel announce-ip <%= $redis::sentinel::sentinel_announce_ip %>
27+
<%- } -%>
28+
<% if $redis::sentinel::sentinel_announce_port { -%>
29+
sentinel announce-port <%= $redis::sentinel::sentinel_announce_port %>
30+
<%- } -%>
31+
<% if $redis::sentinel::sentinel_resolve_hostnames { -%>
32+
sentinel resolve-hostnames <%= $redis::sentinel::sentinel_resolve_hostnames %>
33+
<%- } -%>
34+
sentinel monitor <%= $redis::sentinel::master_name %> <%= $redis::sentinel::redis_host %> <%= $redis::sentinel::redis_port %> <%= $redis::sentinel::quorum %>
35+
sentinel down-after-milliseconds <%= $redis::sentinel::master_name %> <%= $redis::sentinel::down_after %>
36+
sentinel parallel-syncs <%= $redis::sentinel::master_name %> <%= $redis::sentinel::parallel_sync %>
37+
sentinel failover-timeout <%= $redis::sentinel::master_name %> <%= $redis::sentinel::failover_timeout %>
38+
<% if $redis::sentinel::auth_pass { -%>
39+
sentinel auth-pass <%= $redis::sentinel::master_name %> <%= $redis::sentinel::auth_pass.unwrap %>
40+
<%- } -%>
41+
<% if $redis::sentinel::notification_script { -%>
42+
sentinel notification-script <%= $redis::sentinel::master_name %> <%= $redis::sentinel::notification_script %>
43+
<%- } -%>
44+
<% if $redis::sentinel::client_reconfig_script { -%>
45+
sentinel client-reconfig-script <%= $redis::sentinel::master_name %> <%= $redis::sentinel::client_reconfig_script %>
46+
<%- } -%>
47+
<% if $redis::sentinel::requirepass { -%>
48+
requirepass <%= $redis::sentinel::requirepass %>
49+
<%- } -%>
50+
<% if $redis::sentinel::sentinel_tls_port { -%>
51+
52+
tls-cert-file <%= $redis::sentinel::tls_cert_file %>
53+
tls-key-file <%= $redis::sentinel::tls_key_file %>
54+
<% if $redis::sentinel::tls_key_file_pass { -%>
55+
tls-key-file-pass <%= $redis::sentinel::tls_key_file_pass.unwrap %>
56+
<%- } -%>
57+
<% if $redis::sentinel::tls_ca_cert_file { -%>
58+
tls-ca-cert-file <%= $redis::sentinel::tls_ca_cert_file %>
59+
<%- } -%>
60+
<% if $redis::sentinel::tls_ca_cert_dir { -%>
61+
tls-ca-cert-dir <%= $redis::sentinel::tls_ca_cert_dir %>
62+
<%- } -%>
63+
tls-auth-clients <%= $redis::sentinel::tls_auth_clients %>
64+
<% if $redis::sentinel::tls_replication { -%>
65+
tls-replication <%= $redis::sentinel::tls_replication ? { true => 'yes', false => 'no' } %>
66+
<%- } -%>
67+
<%- } -%>
68+
69+
loglevel <%= $redis::sentinel::log_level %>
70+
logfile <%= $redis::sentinel::log_file %>
71+
<% unless $redis::sentinel::acls.empty { -%>
72+
73+
<% $redis::sentinel::acls.each |$acl| { -%>
74+
<%= $acl %>
75+
<%- } -%>
76+
<%- } -%>

templates/redis-sentinel.conf.erb

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)