Skip to content

Commit 86d96aa

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

File tree

4 files changed

+81
-80
lines changed

4 files changed

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

templates/redis-sentinel.conf.erb

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

0 commit comments

Comments
 (0)