Showing with 195 additions and 32 deletions.
  1. +1 −0 .fixtures.yml
  2. +13 −16 .travis.yml
  3. +10 −0 README.md
  4. +4 −0 manifests/config.pp
  5. +32 −0 manifests/init.pp
  6. +7 −0 manifests/params.pp
  7. +12 −12 manifests/preinstall.pp
  8. +1 −0 manifests/service.pp
  9. +7 −3 metadata.json
  10. +81 −1 spec/classes/redis_spec.rb
  11. +27 −0 templates/redis.conf.erb
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ fixtures:
repositories:
apt: 'git://github.com/puppetlabs/puppetlabs-apt.git'
stdlib: 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
epel: 'https://github.com/stahnma/puppet-module-epel.git'

symlinks:
redis: "#{source_dir}"
Expand Down
29 changes: 13 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
---
language: ruby

cache: bundler
sudo: false

rvm:
- 1.8.7
- 1.9.3
- 2.0.0
- 2.1.3

matrix:
allow_failures:
- rvm: 1.8.7
- rvm: 2.0.0
env: PUPPET_VERSION="2.7"
- env: PUPPET_VERSION="2.7"
- env: PUPPET_VERSION="4.0"
- env: PUPPET_VERSION="3.7" FUTURE_PARSER="yes"
- env: PUPPET_VERSION="3.8" FUTURE_PARSER="yes"

before_install:
- 'gem install bundler'

script:
- 'bundle exec rake spec'
- bundle install
- bundle update
- bundle exec rake

env:
- PUPPET_VERSION="2.7"
- PUPPET_VERSION="3.0"
- PUPPET_VERSION="3.1"
- PUPPET_VERSION="3.2"
Expand All @@ -31,10 +29,9 @@ env:
- PUPPET_VERSION="3.5"
- PUPPET_VERSION="3.6"
- PUPPET_VERSION="3.7"
- PUPPET_VERSION="3.7" FUTURE_PARSER="yes"
- PUPPET_VERSION="3.8"
- PUPPET_VERSION="3.8" FUTURE_PARSER="yes"
- PUPPET_VERSION="4.0"

branches:
only:
- master
- develop

- PUPPET_VERSION="4.1"
- PUPPET_VERSION="4.2"
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
#masterauth => 'secret';
}

### Redis 3.0 Clustering

class { 'redis':
bind => '10.0.1.2',
appendonly => true,
cluster_enabled => true,
cluster_config_file => 'nodes.conf',
cluster_node_timeout => 5000,
}

### Manage repositories

Disabled by default but if you really want the module to manage the required
Expand Down
4 changes: 4 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@
$slowlog_max_len = $::redis::slowlog_max_len
$hash_max_ziplist_entries = $::redis::hash_max_ziplist_entries
$hash_max_ziplist_value = $::redis::hash_max_ziplist_value
$hz = $::redis::hz
$list_max_ziplist_entries = $::redis::list_max_ziplist_entries
$list_max_ziplist_value = $::redis::list_max_ziplist_value
$set_max_intset_entries = $::redis::set_max_intset_entries
$zset_max_ziplist_entries = $::redis::zset_max_ziplist_entries
$zset_max_ziplist_value = $::redis::zset_max_ziplist_value
$activerehashing = $::redis::activerehashing
$extra_config_file = $::redis::extra_config_file
$cluster_enabled = $::redis::cluster_enabled
$cluster_config_file = $::redis::cluster_config_file
$cluster_node_timeout = $::redis::cluster_node_timeout

if $::redis::notify_service {
File {
Expand Down
32 changes: 32 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@
#
# Default: 64
#
# [*hz*]
# Set redis background tasks frequency
#
# Default: 10
#
# [*list_max_ziplist_entries*]
# Set max ziplist entries for lists.
#
Expand Down Expand Up @@ -274,6 +279,11 @@
#
# Default: OS dependant
#
# [*service_provider*]
# Specify the service provider to use
#
# Default: undef
#
# [*service_user*]
# Specify which user to run as.
#
Expand Down Expand Up @@ -358,6 +368,23 @@
#
# Default: 64
#
# [*cluster_enabled*]
# Enables redis 3.0 cluster functionality
#
# Default: false
#
# [*cluster_config_file*]
# Config file for saving cluster nodes configuration. This file is never touched by humans.
# Only set if cluster_enabled is true
#
# Default: nodes.conf
#
# [*cluster_node_timeout*]
# Node timeout
# Only set if cluster_enabled is true
#
# Default: 5000
#
# == Actions:
# - Install and configure Redis
#
Expand Down Expand Up @@ -389,6 +416,7 @@
$extra_config_file = $::redis::params::extra_config_file,
$hash_max_ziplist_entries = $::redis::params::hash_max_ziplist_entries,
$hash_max_ziplist_value = $::redis::params::hash_max_ziplist_value,
$hz = $::redis::params::hz,
$list_max_ziplist_entries = $::redis::params::list_max_ziplist_entries,
$list_max_ziplist_value = $::redis::params::list_max_ziplist_value,
$log_dir = $::redis::params::log_dir,
Expand Down Expand Up @@ -420,6 +448,7 @@
$service_hasstatus = $::redis::params::service_hasstatus,
$service_manage = $::redis::params::service_manage,
$service_name = $::redis::params::service_name,
$service_provider = $::redis::params::service_provider,
$service_user = $::redis::params::service_user,
$set_max_intset_entries = $::redis::params::set_max_intset_entries,
$slave_read_only = $::redis::params::slave_read_only,
Expand All @@ -434,6 +463,9 @@
$workdir = $::redis::params::workdir,
$zset_max_ziplist_entries = $::redis::params::zset_max_ziplist_entries,
$zset_max_ziplist_value = $::redis::params::zset_max_ziplist_value,
$cluster_enabled = $::redis::params::cluster_enabled,
$cluster_config_file = $::redis::params::cluster_config_file,
$cluster_node_timeout = $::redis::params::cluster_node_timeout,
) inherits redis::params {
anchor { 'redis::begin': }
anchor { 'redis::end': }
Expand Down
7 changes: 7 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
$extra_config_file = undef
$hash_max_ziplist_entries = 512
$hash_max_ziplist_value = 64
$hz = 10
$list_max_ziplist_entries = 512
$list_max_ziplist_value = 64
$log_dir = '/var/log/redis'
Expand Down Expand Up @@ -51,6 +52,7 @@
$sentinel_init_template = 'redis/redis-sentinel.init.erb'
$sentinel_pid_file = '/var/run/redis/redis-sentinel.pid'
$sentinel_notification_script = undef
$service_provider = undef
$set_max_intset_entries = 512
$slowlog_log_slower_than = 10000
$slowlog_max_len = 1024
Expand All @@ -70,6 +72,11 @@
$slave_serve_stale_data = true
$slaveof = undef

# redis.conf.erb - redis 3.0 clustering
$cluster_enabled = false
$cluster_config_file = 'nodes.conf'
$cluster_node_timeout = 5000

case $::osfamily {
'Debian': {
$config_dir = '/etc/redis'
Expand Down
24 changes: 12 additions & 12 deletions manifests/preinstall.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
if $::redis::manage_repo {
case $::operatingsystem {
'RedHat', 'CentOS', 'Scientific', 'OEL': {
if $::operatingsystemrelease < 7 {
$rpm_url = $::operatingsystemrelease ? {
/^5/ => "http://download.powerstack.org/5/${::architecture}/",
/^6/ => "http://download.powerstack.org/6/${::architecture}/",
if $::operatingsystemmajrelease < '7' {
$rpm_url = $::operatingsystemmajrelease ? {
'5' => "http://download.powerstack.org/5/${::architecture}/",
'6' => "http://download.powerstack.org/6/${::architecture}/",
default => Fail['Operating system or release not supported.'],
}

$rpm_gpgkey = $::operatingsystemrelease ? {
/^5/ => 'https://raw.githubusercontent.com/santisaez/powerstack/master/RPM-GPG-KEY-powerstack',
/^6/ => 'https://raw.githubusercontent.com/santisaez/powerstack/master/RPM-GPG-KEY-powerstack',
$rpm_gpgkey = $::operatingsystemmajrelease ? {
'5' => 'https://raw.githubusercontent.com/santisaez/powerstack/master/RPM-GPG-KEY-powerstack',
'6' => 'https://raw.githubusercontent.com/santisaez/powerstack/master/RPM-GPG-KEY-powerstack',
default => Fail['Operating system or release not supported.'],
}

Expand All @@ -29,19 +29,19 @@
}
}

if $::operatingsystemrelease == 7 {
if $::operatingsystemmajrelease == '7' {
require ::epel
}
}

'Amazon': {
$rpm_url = $::operatingsystemrelease ? {
/^3/ => "http://download.powerstack.org/6/${::architecture}/",
$rpm_url = $::operatingsystemmajrelease ? {
'3' => "http://download.powerstack.org/6/${::architecture}/",
default => Fail['Operating system or release version not supported.'],
}

$rpm_gpgkey = $::operatingsystemrelease ? {
/^3/ => 'https://raw.githubusercontent.com/santisaez/powerstack/master/RPM-GPG-KEY-powerstack',
$rpm_gpgkey = $::operatingsystemmajrelease ? {
'3' => 'https://raw.githubusercontent.com/santisaez/powerstack/master/RPM-GPG-KEY-powerstack',
default => Fail['Operating system or release version not supported.'],
}

Expand Down
1 change: 1 addition & 0 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
enable => $::redis::service_enable,
hasrestart => $::redis::service_hasrestart,
hasstatus => $::redis::service_hasstatus,
provider => $::redis::service_provider,
}
}
}
Expand Down
10 changes: 7 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arioch-redis",
"version": "1.1.3",
"version": "1.2.0",
"author": "Tom De Vylder",
"summary": "Redis module",
"license": "Apache-2.0",
Expand Down Expand Up @@ -58,7 +58,9 @@
"6.2",
"6.3",
"6.4",
"6.5"
"6.5",
"7.0",
"7.1"
]
},
{
Expand All @@ -69,7 +71,9 @@
"6.2",
"6.3",
"6.4",
"6.5"
"6.5",
"7.0",
"7.1"
]
}
]
Expand Down
82 changes: 81 additions & 1 deletion spec/classes/redis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,24 @@
{
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6'
:operatingsystemmajrelease => '6'
}
}

it { should create_yumrepo('powerstack').with_enabled(1) }
end

context 'on RHEL 7' do
let (:facts) {
{
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemmajrelease => '7'
}
}

it { should contain_class('epel') }
end
end

describe 'with parameter masterauth' do
Expand Down Expand Up @@ -450,6 +462,19 @@
}
end

describe 'with parameter hz' do
let (:params) {
{
:hz=> '_VALUE_'
}
}

it { should contain_file('/etc/redis/redis.conf').with(
'content' => /hz.*_VALUE_/
)
}
end

describe 'with parameter rdbcompression' do
let (:params) {
{
Expand Down Expand Up @@ -752,5 +777,60 @@
)
}
end

describe 'with parameter cluster_enabled-false' do
let (:params) {
{
:cluster_enabled => false
}
}

it { should contain_file('/etc/redis/redis.conf').with(
'content' => /cluster-enabled.*no/
)
}
end

describe 'with parameter cluster_enabled-true' do
let (:params) {
{
:cluster_enabled => true
}
}

it { should contain_file('/etc/redis/redis.conf').with(
'content' => /cluster-enabled.*yes/
)
}
end

describe 'with parameter cluster_config_file' do
let (:params) {
{
:cluster_enabled => true,
:cluster_config_file => '_VALUE_'
}
}

it { should contain_file('/etc/redis/redis.conf').with(
'content' => /cluster-config-file.*_VALUE_/
)
}
end

describe 'with parameter cluster_config_file' do
let (:params) {
{
:cluster_enabled => true,
:cluster_node_timeout => '_VALUE_'
}
}

it { should contain_file('/etc/redis/redis.conf').with(
'content' => /cluster-node-timeout.*_VALUE_/
)
}
end

end

Loading