Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add redis::instance defined type #200

Merged
merged 1 commit into from
Jul 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 7 additions & 92 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,70 +3,6 @@
# This class provides configuration for Redis.
#
class redis::config {
$activerehashing = $::redis::activerehashing
$aof_load_truncated = $::redis::aof_load_truncated
$aof_rewrite_incremental_fsync = $::redis::aof_rewrite_incremental_fsync
$appendfilename = $::redis::appendfilename
$appendfsync = $::redis::appendfsync
$appendonly = $::redis::appendonly
$auto_aof_rewrite_min_size = $::redis::auto_aof_rewrite_min_size
$auto_aof_rewrite_percentage = $::redis::auto_aof_rewrite_percentage
$bind = $::redis::bind
$cluster_config_file = $::redis::cluster_config_file
$cluster_enabled = $::redis::cluster_enabled
$cluster_node_timeout = $::redis::cluster_node_timeout
$daemonize = $::redis::daemonize
$databases = $::redis::databases
$dbfilename = $::redis::dbfilename
$extra_config_file = $::redis::extra_config_file
$hash_max_ziplist_entries = $::redis::hash_max_ziplist_entries
$hash_max_ziplist_value = $::redis::hash_max_ziplist_value
$hll_sparse_max_bytes = $::redis::hll_sparse_max_bytes
$hz = $::redis::hz
$latency_monitor_threshold = $::redis::latency_monitor_threshold
$list_max_ziplist_entries = $::redis::list_max_ziplist_entries
$list_max_ziplist_value = $::redis::list_max_ziplist_value
$log_file = $::redis::log_file
$log_level = $::redis::log_level
$masterauth = $::redis::masterauth
$maxclients = $::redis::maxclients
$maxmemory = $::redis::maxmemory
$maxmemory_policy = $::redis::maxmemory_policy
$maxmemory_samples = $::redis::maxmemory_samples
$min_slaves_max_lag = $::redis::min_slaves_max_lag
$min_slaves_to_write = $::redis::min_slaves_to_write
$minimum_version = $::redis::minimum_version
$no_appendfsync_on_rewrite = $::redis::no_appendfsync_on_rewrite
$notify_keyspace_events = $::redis::notify_keyspace_events
$pid_file = $::redis::pid_file
$port = $::redis::port
$rdbcompression = $::redis::rdbcompression
$repl_backlog_size = $::redis::repl_backlog_size
$repl_backlog_ttl = $::redis::repl_backlog_ttl
$repl_disable_tcp_nodelay = $::redis::repl_disable_tcp_nodelay
$repl_ping_slave_period = $::redis::repl_ping_slave_period
$repl_timeout = $::redis::repl_timeout
$requirepass = $::redis::requirepass
$save_db_to_disk = $::redis::save_db_to_disk
$save_db_to_disk_interval = $::redis::save_db_to_disk_interval
$set_max_intset_entries = $::redis::set_max_intset_entries
$slave_priority = $::redis::slave_priority
$slave_read_only = $::redis::slave_read_only
$slave_serve_stale_data = $::redis::slave_serve_stale_data
$slaveof = $::redis::slaveof
$slowlog_log_slower_than = $::redis::slowlog_log_slower_than
$slowlog_max_len = $::redis::slowlog_max_len
$stop_writes_on_bgsave_error = $::redis::stop_writes_on_bgsave_error
$syslog_enabled = $::redis::syslog_enabled
$syslog_facility = $::redis::syslog_facility
$tcp_backlog = $::redis::tcp_backlog
$tcp_keepalive = $::redis::tcp_keepalive
$timeout = $::redis::timeout
$unixsocket = $::redis::unixsocket
$unixsocketperm = $::redis::unixsocketperm
$workdir = $::redis::workdir
$zset_max_ziplist_entries = $::redis::zset_max_ziplist_entries
$zset_max_ziplist_value = $::redis::zset_max_ziplist_value

File {
owner => $::redis::config_owner,
Expand All @@ -79,28 +15,6 @@
mode => $::redis::config_dir_mode,
}

file {$::redis::config_file_orig:
ensure => file,
}

$redis_version_real = pick(getvar_emptystring('redis_server_version'), $minimum_version)

if ($redis_version_real and $::redis::conf_template == 'redis/redis.conf.erb') {
case $redis_version_real {
/^2.4./: {
File[$::redis::config_file_orig] { content => template('redis/redis.conf.2.4.10.erb') }
}
/^2.8./: {
File[$::redis::config_file_orig] { content => template('redis/redis.conf.2.8.erb') }
}
default: {
File[$::redis::config_file_orig] { content => template($::redis::conf_template) }
}
}
} else {
File[$::redis::config_file_orig] { content => template($::redis::conf_template) }
}

file {$::redis::log_dir:
ensure => directory,
group => $::redis::service_group,
Expand All @@ -115,14 +29,15 @@
owner => $::redis::service_user,
}

if $::redis::ulimit {
contain ::redis::ulimit
if $::redis::default_install {
redis::instance {'default':
pid_file => $::redis::pid_file,
manage_service_file => $::redis::manage_service_file,
}
}

exec {"cp -p ${::redis::config_file_orig} ${::redis::config_file}":
path => '/usr/bin:/bin',
subscribe => File[$::redis::config_file_orig],
refreshonly => true;
if $::redis::ulimit {
contain ::redis::ulimit
}

# Adjust /etc/default/redis-server on Debian systems
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
# @param [String] config_owner Adjust filesystem owner for config files.
# @param [String] conf_template Define which template to use.
# @param [String] daemonize Have Redis run as a daemon.
# @param [String] default_install Configure a default install of redis
# @param [String] databases Set the number of databases.
# @param [String] dbfilename The filename where to dump the DB
# @param [String] extra_config_file Description
Expand Down Expand Up @@ -152,6 +153,7 @@
$config_owner = $::redis::params::config_owner,
$daemonize = $::redis::params::daemonize,
$databases = $::redis::params::databases,
$default_install = $::redis::params::default_install,
$dbfilename = $::redis::params::dbfilename,
$extra_config_file = $::redis::params::extra_config_file,
$hash_max_ziplist_entries = $::redis::params::hash_max_ziplist_entries,
Expand Down
Loading