Showing with 126 additions and 28 deletions.
  1. +0 −10 Modulefile
  2. +13 −5 manifests/config.pp
  3. +12 −10 manifests/init.pp
  4. +1 −0 manifests/params.pp
  5. +23 −3 manifests/preinstall.pp
  6. +65 −0 metadata.json
  7. +12 −0 spec/classes/redis_spec.rb
10 changes: 0 additions & 10 deletions Modulefile

This file was deleted.

18 changes: 13 additions & 5 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
# This class provides configuration for Redis.
#
class redis::config {
File {
owner => $::redis::config_owner,
group => $::redis::config_group,
mode => $::redis::config_file_mode,
notify => Service[$::redis::service_name],
if $::redis::notify_service {
File {
owner => $::redis::config_owner,
group => $::redis::config_group,
mode => $::redis::config_file_mode,
notify => Service[$::redis::service_name]
}
} else {
File {
owner => $::redis::config_owner,
group => $::redis::config_group,
mode => $::redis::config_file_mode,
}
}

file {
Expand Down
22 changes: 12 additions & 10 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
$maxmemory_policy = $::redis::params::maxmemory_policy,
$maxmemory_samples = $::redis::params::maxmemory_samples,
$no_appendfsync_on_rewrite = $::redis::params::no_appendfsync_on_rewrite,
$notify_service = $::redis::params::notify_service,
$package_ensure = $::redis::params::package_ensure,
$package_name = $::redis::params::package_name,
$pid_file = $::redis::params::pid_file,
Expand Down Expand Up @@ -79,16 +80,17 @@
$zset_max_ziplist_entries = $::redis::params::zset_max_ziplist_entries,
$zset_max_ziplist_value = $::redis::params::zset_max_ziplist_value,
) inherits redis::params {

include preinstall
include install
include config
include service

Class['preinstall'] ->
Class['install'] ->
Class['config'] ~>
Class['service']
if $::redis::notify_service {
Class['preinstall'] ->
Class['install'] ->
Class['config'] ~>
Class['service']
} else {
Class['preinstall'] ->
Class['install'] ->
Class['config'] ->
Class['service']
}

# Sanity check
if $::redis::slaveof {
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
$maxmemory_policy = undef
$maxmemory_samples = undef
$no_appendfsync_on_rewrite = false
$notify_service = true
$pid_file = '/var/run/redis/redis-server.pid'
$port = 6379
$rdbcompression = true
Expand Down
26 changes: 23 additions & 3 deletions manifests/preinstall.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,36 @@
class redis::preinstall {
if $::redis::manage_repo {
case $::operatingsystem {
'RedHat', 'CentOS', 'Scientific', 'OEL', 'Amazon': {
'RedHat', 'CentOS', 'Scientific', 'OEL': {
$rpm_url = $::operatingsystemrelease ? {
/^5/ => "http://download.powerstack.org/5/${::architecture}/",
/^6/ => "http://download.powerstack.org/6/${::architecture}/",
default => Fail['Operating system or release version not supported.'],
}

$rpm_gpgkey = $::operatingsystemrelease ? {
/^5/ => 'https://raw.github.com/santisaez/powerstack/master/RPM-GPG-KEY-powerstack',
/^6/ => 'https://raw.github.com/santisaez/powerstack/master/RPM-GPG-KEY-powerstack',
/^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 version not supported.'],
}

yumrepo { 'powerstack':
descr => 'PowerStack for CentOS',
baseurl => $rpm_url,
gpgkey => $rpm_gpgkey,
enabled => 1,
gpgcheck => 1;
}
}

'Amazon': {
$rpm_url = $::operatingsystemrelease ? {
/^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',
default => Fail['Operating system or release version not supported.'],
}

Expand Down
65 changes: 65 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "arioch-redis",
"version": "0.0.9",
"author": "Tom De Vylder",
"summary": "Redis module",
"license": "Apache License, Version 2.0",
"source": "https://github.com/arioch/puppet-redis",
"project_page": "http://arioch.github.io/puppet-redis/",
"issues_url": "https://github.com/arioch/puppet-redis/issues",
"description": "Redis module with cluster support",
"tags": [
"redis",
"cluster",
"failover",
"loadbalancing"
],
"operatingsystem_support": [
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"6.0",
"6.1",
"6.2",
"6.3",
"6.4",
"6.5",
"6.6",
"6.6",
"6.7",
"6.9",
"7.0",
"7.1",
"7.2",
"7.3",
"7.4",
"7.5"
]
},
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"6.0",
"6.1",
"6.2",
"6.3",
"6.4",
"6.5"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"6.0",
"6.1",
"6.2",
"6.3",
"6.4",
"6.5"
]
}
],
"dependencies": [

]
}
12 changes: 12 additions & 0 deletions spec/classes/redis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,18 @@
}
end

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

it { should contain_file('/etc/redis/redis.conf').that_notifies('Service[redis-server]'
)
}
end

describe 'with parameter no_appendfsync_on_rewrite' do
let (:params) {
{
Expand Down