Use puppet-redis to deploy Redis

Change-Id: I955452d98399ba01af101f872235958a7b8c96c3
This commit is contained in:
Takashi Kajinami 2022-02-05 23:37:14 +09:00
parent d8c452f91a
commit bf1a8bda62
3 changed files with 13 additions and 30 deletions

View File

@ -230,3 +230,6 @@ mod 'ssh_keygen',
:git => 'https://github.com/voxpupuli/puppet-ssh_keygen',
:ref => 'v2.0.1'
mod 'redis',
:git => 'https://github.com/voxpupuli/puppet-redis',
:ref => 'v8.2.0'

View File

@ -19,3 +19,4 @@ theforeman/puppet-dns
voxpupuli/puppet-archive
voxpupuli/puppet-corosync,v8.0.0
voxpupuli/puppet-ssh_keygen,v2.0.1
voxpupuli/puppet-redis

View File

@ -1,21 +1,16 @@
class openstack_integration::redis {
include openstack_integration::config
# NOTE(tobias-urdin): Manually manage redis until arioch/puppet-redis support
# redis 4.x since that is used by Ubuntu Bionic.
# TODO(tkajinam): Remove this once puppet-redis supports CentOS 9
case $::osfamily {
'Debian': {
$redis_package_name = 'redis-server'
$redis_service_name = 'redis-server'
$redis_config = '/etc/redis/redis.conf'
$redis_config = '/etc/redis/redis.conf'
}
'RedHat': {
$redis_package_name = 'redis'
$redis_service_name = 'redis'
if versioncmp($::operatingsystemmajrelease, '8') > 0 {
$redis_config = '/etc/redis/redis.conf'
$redis_config = '/etc/redis/redis.conf'
} else {
$redis_config = '/etc/redis.conf'
$redis_config = '/etc/redis.conf'
}
}
default: {
@ -23,26 +18,10 @@ class openstack_integration::redis {
}
}
# NOTE(tobias-urdin): Manually manage redis until arioch/puppet-redis support
# redis 4.x since that is used by Ubuntu Bionic.
package { 'redis':
ensure => 'present',
name => $redis_package_name,
}
file_line { 'redis_config':
ensure => 'present',
path => $redis_config,
line => "bind ${::openstack_integration::config::host}",
match => '^bind\ ',
require => Package['redis'],
notify => Service['redis'],
}
service { 'redis':
ensure => 'running',
name => $redis_service_name,
enable => true,
require => File_line['redis_config'],
class { 'redis':
bind => $::openstack_integration::config::host,
config_file => $redis_config,
config_file_orig => "${redis_config}.puppet",
ulimit_managed => false,
}
}