Skip to content
This repository was archived by the owner on Mar 8, 2023. It is now read-only.

Commit ec430e7

Browse files
committed
Merge pull request #57 from echocat/develop
backmerge for release 1.7.0
2 parents d083389 + 047db2d commit ec430e7

10 files changed

+94
-11
lines changed

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
## 2015-12-02 - 1.7.0 (Feature/Bugfix release)
2+
3+
#### Features:
4+
5+
- (3236f41) #33 add Scientific Linux support
6+
- (ad5d3c1) #37 Server: add parameters `redis_usesocket` `redis_socket` `redis_socketperm` `redis_memsamples`
7+
- (edf870b) #31 Server: add parameters `force_rewrite`
8+
- (e1c2011) #53 Server: add parameters `hash_max_ziplist_entries` and `hash_max_ziplist_value`
9+
- (f1006e2) #48 Server: add parameters `redis_user` and `redis_group`
10+
- (42bb23f) #44 Sentinel: explititly define sentinel pidfile
11+
12+
#### Bugfixes:
13+
14+
- (3e920e3) #35 Server: correct usage of `redis_timeout` in servers
15+
- (f8e44b2) #39 avoid conflicts build-essential
16+
- (75cffe8) #51 prevent default redis-server from automatically start
17+
18+
119
## 2015-05-11 - 1.6.0 (Feature/Bugfix release)
220

321
#### Features:

README.md

+29-1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,18 @@ node 'redis-slave.my.domain' {
138138
}
139139
```
140140

141+
### Example using Hiera
142+
143+
redis::install::redis_package: true
144+
redis::install::redis_version: '2:2.8.17-1+deb8u1'
145+
redis::servers:
146+
'name_server':
147+
requirepass: 'strongpass'
148+
enabled: true
149+
redis_ip: '0.0.0.0'
150+
redis_port: '6800'
151+
redis_log_dir: '/var/log/redis/'
152+
141153
###Setting up sentinel with two monitors
142154

143155
You can create multiple sentinels on one node. But most of the time you will
@@ -184,7 +196,7 @@ The redis service(s) are configured with the defined type `redis::server`.
184196
####Class: `redis::install`
185197

186198
This class downloads, compiles and installs redis. It does not configure any
187-
redis services. This is done by defimed type redis::server.
199+
redis services. This is done by defined type redis::server.
188200

189201
**Parameters within `redis::install`:**
190202

@@ -204,6 +216,22 @@ directoy like '/opt/redis-2.8.8/'
204216
Default is '/usr/bin' (string).
205217
The dir to which the newly built redis binaries are copied.
206218

219+
#####`redis_user`
220+
221+
Redis system user. Default: undef (string)
222+
Default 'undef' results to 'root' as redis system user
223+
224+
Some redis install packages create the redis system user by default (at
225+
least SLES and Ubuntu provide redis install packages).
226+
Normally the log directory and the pid directory are created also by
227+
the redis install package. Therefor, these values must be adjusted too.
228+
229+
230+
#####`redis_group`
231+
232+
Redis system group. Default: undef (string)
233+
Default 'undef' results to 'root' as redis system group
234+
207235
####Defined Type: `redis::server`
208236

209237
Used to configure redis instances. You can setup multiple redis servers on the

manifests/init.pp

+12-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
#
55
# === Parameters
66
#
7-
# None.
7+
# [*servers*]
8+
# Hash for servers instantiation from hiera
89
#
9-
class redis inherits redis::params {}
10+
class redis (
11+
# START Hiera Lookups ###
12+
$servers = {},
13+
### END Hiera Lookups ###
14+
) inherits redis::params {
15+
16+
create_resources('redis::server', $servers)
17+
18+
}
19+

manifests/install.pp

+13-1
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,29 @@
1414
# [*redis_install_dir*]
1515
# The dir to which the newly built redis binaries are copied. Default value is '/usr/bin'.
1616
#
17+
# [*redis_user*]
18+
# The redis system user. Default value is 'undef', which results to 'root' as system user.
19+
#
20+
# [*redis_group*]
21+
# The redis system group. Default value is 'undef', which results to 'root' as system group.
22+
#
1723
class redis::install (
1824
$redis_version = $::redis::params::redis_version,
1925
$redis_build_dir = $::redis::params::redis_build_dir,
2026
$redis_install_dir = $::redis::params::redis_install_dir,
2127
$redis_package = $::redis::params::redis_install_package,
22-
$download_tool = $::redis::params::download_tool
28+
$download_tool = $::redis::params::download_tool,
29+
$redis_user = $::redis::params::redis_user,
30+
$redis_group = $::redis::params::redis_group,
2331
) inherits redis {
2432
if ( $redis_package == true ) {
2533
case $::operatingsystem {
2634
'Debian', 'Ubuntu': {
2735
package { 'redis-server' : ensure => $redis_version, }
36+
service { 'redis-server' :
37+
ensure => stopped,
38+
subscribe => Package['redis-server']
39+
}
2840
}
2941
'Fedora', 'RedHat', 'CentOS', 'OEL', 'OracleLinux', 'Amazon', 'Scientific', 'SLES': {
3042
package { 'redis' : ensure => $redis_version, }

manifests/params.pp

+2
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66
$redis_install_dir = '/usr/bin'
77
$redis_install_package = false
88
$download_tool = 'curl -s -L'
9+
$redis_user = undef
10+
$redis_group = undef
911
}

manifests/server.pp

+10
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@
7171
# Configure Redis replication ping slave period
7272
# [*save*]
7373
# Configure Redis save snapshotting. Example: [[900, 1], [300, 10]]. Default: []
74+
# [*hash_max_ziplist_entries*]
75+
# Threshold for ziplist entries. Default: 512
76+
# [*hash_max_ziplist_value*]
77+
# Threshold for ziplist value. Default: 64
7478
#
7579
# [*force_rewrite*]
7680
#
@@ -117,8 +121,12 @@
117121
$repl_timeout = 60,
118122
$repl_ping_slave_period = 10,
119123
$save = [],
124+
$hash_max_ziplist_entries = 512,
125+
$hash_max_ziplist_value = 64,
120126
$force_rewrite = false,
121127
) {
128+
$redis_user = $::redis::install::redis_user
129+
$redis_group = $::redis::install::redis_group
122130

123131
$redis_install_dir = $::redis::install::redis_install_dir
124132
$redis_init_script = $::operatingsystem ? {
@@ -164,6 +172,8 @@
164172
file { "${redis_dir}/redis_${redis_name}":
165173
ensure => directory,
166174
require => Class['redis::install'],
175+
owner => $redis_user,
176+
group => $redis_group,
167177
}
168178

169179
# install and configure logrotate

metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
}
3131
],
3232
"name": "dwerder-redis",
33-
"version": "1.6.0",
33+
"version": "1.7.0",
3434
"source": "git clone https://github.com/echocat/puppet-redis.git",
3535
"author": "Daniel Werdermann",
3636
"license": "MPL-2.0",

templates/etc/init.d/sles_redis-server.erb

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
### END INIT INFO
2323

2424
EXEC=/usr/sbin/redis-server
25-
USER=redis
25+
USER=<%= @redis_user or 'root' %>
26+
GROUP=<%= @redis_group or 'root' %>
2627
STATE=<%= @redis_pid_dir %>
2728
CONF=/etc
2829
PIDFILE=${STATE}/redis_<%= @redis_name %>.pid
@@ -31,7 +32,7 @@ CONFIG=${CONF}/redis_<%= @redis_name %>.conf
3132
. /etc/rc.status
3233

3334
if [ ! -d $STATE ]; then
34-
install -d $state -o $USER -g $USER -m 0755 $STATE
35+
install -d $state -o $USER -g $GROUP -m 0755 $STATE
3536
fi
3637

3738
start() {

templates/etc/redis.conf.erb

+4-4
Original file line numberDiff line numberDiff line change
@@ -429,11 +429,11 @@ slowlog-max-len 1024
429429
# small number of entries, and the biggest entry does not exceed a given
430430
# threshold. These thresholds can be configured using the following directives.
431431
<% if @redis_2_6_or_greater -%>
432-
hash-max-ziplist-entries 512
433-
hash-max-ziplist-value 64
432+
hash-max-ziplist-entries <%= @hash_max_ziplist_entries %>
433+
hash-max-ziplist-value <%= @hash_max_ziplist_value %>
434434
<% else -%>
435-
hash-max-zipmap-entries 512
436-
hash-max-zipmap-value 64
435+
hash-max-zipmap-entries <%= @hash_max_ziplist_entries %>
436+
hash-max-zipmap-value <%= @hash_max_ziplist_value %>
437437
<% end -%>
438438

439439
# Similarly to hashes, small lists are also encoded in a special way in order

templates/etc/sentinel.conf.erb

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
daemonize yes
66

7+
pidfile <%= @sentinel_pid_dir %>/redis-sentinel_<%= @sentinel_name %>.pid
8+
79
logfile <%= @sentinel_log_dir -%>/redis-sentinel_<%= @sentinel_name %>.log
810

911
port <%= @sentinel_port -%>

0 commit comments

Comments
 (0)