Page MenuHomeSoftware Heritage

sentinel.pp
No OneTemporary

sentinel.pp

# = Class: redis::sentinel
#
# This class install redis-sentinel
#
# == Parameters:
#
# [*config_file*]
# The location and name of the sentinel config file.
#
# Default for deb: /etc/redis/redis-sentinel.conf
# Default for rpm: /etc/redis-sentinel.conf
#
# [*config_file_orig*]
# The location and name of a config file that provides the source
# of the sentinel config file. Two different files are needed
# because sentinel itself writes to its own config file and we do
# not want override that when puppet is run unless there are
# changes from the manifests.
#
# Default for deb: /etc/redis/redis-sentinel.conf.puppet
# Default for rpm: /etc/redis-sentinel.conf.puppet
#
# [*config_file_mode*]
# Permissions of config file.
#
# Default: 0644
#
# [*conf_template*]
# Define which template to use.
#
# Default: redis/redis-sentinel.conf.erb
#
# [*down_after*]
# Number of milliseconds the master (or any attached slave or sentinel)
# should be unreachable (as in, not acceptable reply to PING, continuously,
# for the specified period) in order to consider it in S_DOWN state.
#
# Default: 30000
#
# [*failover_timeout*]
# Specify the failover timeout in milliseconds.
#
# Default: 180000
#
# [*log_file*]
# Specify where to write log entries.
#
# Default: /var/log/redis/redis.log
#
# [*master_name*]
# Specify the name of the master redis server.
# The valid charset is A-z 0-9 and the three characters ".-_".
#
# Default: mymaster
#
# [*redis_host*]
# Specify the bound host of the master redis server.
#
# Default: 127.0.0.1
#
# [*redis_port*]
# Specify the port of the master redis server.
#
# Default: 6379
#
# [*parallel_sync*]
# How many slaves can be reconfigured at the same time to use a
# new master after a failover.
#
# Default: 1
#
# [*quorum*]
# Number of sentinels that must agree that a master is down to
# signal sdown state.
#
# Default: 2
#
# [*sentinel_port*]
# The port of sentinel server.
#
# Default: 26379
#
# [*service_group*]
# The group of the config file.
#
# Default: redis
#
# [*service_name*]
# The name of the service (for puppet to manage).
#
# Default: redis-sentinel
#
# [*service_owner*]
# The owner of the config file.
#
# Default: redis
#
# [*working_dir*]
# The directory into which sentinel will change to avoid mount
# conflicts.
#
# Default: /tmp
#
# == Actions:
# - Install and configure Redis Sentinel
#
# == Sample Usage:
#
# class { 'redis::sentinel': }
#
# class {'redis::sentinel':
# down_after => 80000,
# log_file => '/var/log/redis/sentinel.log',
# }
#
class redis::sentinel (
$config_file = $::redis::params::sentinel_config_file,
$config_file_orig = $::redis::params::sentinel_config_file_orig,
$config_file_mode = $::redis::params::sentinel_config_file_mode,
$conf_template = $::redis::params::sentinel_conf_template,
$down_after = $::redis::params::sentinel_down_after,
$failover_timeout = $::redis::params::sentinel_failover_timeout,
$log_file = $::redis::params::log_file,
$master_name = $::redis::params::sentinel_master_name,
$redis_host = $::redis::params::bind,
$redis_port = $::redis::params::port,
$parallel_sync = $::redis::params::sentinel_parallel_sync,
$quorum = $::redis::params::sentinel_quorum,
$sentinel_port = $::redis::params::sentinel_port,
$service_group = $::redis::params::service_group,
$service_name = $::redis::params::sentinel_service_name,
$service_user = $::redis::params::service_user,
$working_dir = $::redis::params::sentinel_working_dir,
) inherits redis::params {
file {
$config_file_orig:
ensure => present,
content => template($conf_template);
$config_file:
owner => $service_user,
group => $service_group,
mode => $config_file_mode;
}
exec {
"cp ${config_file_orig} ${config_file}":
path => '/usr/bin:/bin',
subscribe => File[$config_file_orig],
notify => Service[$service_name],
refreshonly => true;
}
service { $service_name:
ensure => $::redis::params::service_ensure,
enable => $::redis::params::service_enable,
hasrestart => $::redis::params::service_hasrestart,
hasstatus => $::redis::params::service_hasstatus,
}
}

File Metadata

Mime Type
text/plain
Expires
Jun 4 2025, 6:59 PM (11 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3398895

Event Timeline