Initial version of redis module
This commit is contained in:
parent
341c86a0a0
commit
c0b4da4547
2 changed files with 72 additions and 0 deletions
66
redis/manifests/init.pp
Normal file
66
redis/manifests/init.pp
Normal file
|
@ -0,0 +1,66 @@
|
|||
# Install Redis.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# $datadir:
|
||||
# Directory for redis database dumps.
|
||||
# Defaults to "/srv/redis".
|
||||
#
|
||||
# $password:
|
||||
# Optional password for client connections.
|
||||
#
|
||||
class redis($datadir="", $password="") {
|
||||
|
||||
package { "redis":
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
if $datadir {
|
||||
file { $datadir:
|
||||
ensure => directory,
|
||||
mode => "0700",
|
||||
owner => "redis",
|
||||
group => "redis",
|
||||
before => File["/srv/redis"],
|
||||
require => Package["redis"],
|
||||
}
|
||||
file { "/srv/redis":
|
||||
ensure => link,
|
||||
target => $datadir,
|
||||
before => Service["redis"],
|
||||
}
|
||||
} else {
|
||||
file { "/srv/redis":
|
||||
ensure => directory,
|
||||
mode => "0700",
|
||||
owner => "redis",
|
||||
group => "redis",
|
||||
before => Service["redis"],
|
||||
require => Package["redis"],
|
||||
}
|
||||
}
|
||||
|
||||
augeas { "set-redis-include":
|
||||
changes => "set include /etc/redis.local.conf",
|
||||
incl => "/etc/redis.conf",
|
||||
lens => "Spacevars.simple_lns",
|
||||
notify => Service["redis"],
|
||||
require => Package["redis"],
|
||||
}
|
||||
|
||||
file { "/etc/redis.local.conf":
|
||||
ensure => present,
|
||||
mode => "0600",
|
||||
owner => "redis",
|
||||
group => "redis",
|
||||
content => template("redis/local.conf.erb"),
|
||||
require => Package["redis"],
|
||||
notify => Service["redis"],
|
||||
}
|
||||
|
||||
service { "redis":
|
||||
ensure => running,
|
||||
enable => true,
|
||||
}
|
||||
|
||||
}
|
6
redis/templates/local.conf.erb
Normal file
6
redis/templates/local.conf.erb
Normal file
|
@ -0,0 +1,6 @@
|
|||
bind 127.0.0.1
|
||||
dir /srv/redis
|
||||
appendonly yes
|
||||
<% if @password -%>
|
||||
requirepass <%= @password %>
|
||||
<% end -%>
|
Loading…
Add table
Reference in a new issue