puppet-openstack-integration/manifests/redis.pp
Alfredo Moralejo bb97772d80 Fix redis config location for centos > 8
The location of redis configuration has been moved to
/etc/redis/redis.conf in CentOS9 [1]. This patch is fixing redis_config
parameter to cover this new case.

[1] https://gitlab.com/redhat/centos-stream/rpms/redis/-/blob/c9s/redis.spec#L332

Change-Id: I92beff3ecc45fba5c12e49351dc8d9f7576777f1
2021-05-20 14:02:18 +02:00

58 lines
1.7 KiB
Puppet

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.
case $::osfamily {
'Debian': {
$redis_package_name = 'redis-server'
$redis_service_name = 'redis-server'
$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'
} else {
$redis_config = '/etc/redis.conf'
}
}
default: {
fail("redis.pp manifest does not support family: ${::osfamily}")
}
}
# due to issues in OpenStack CI with the redis package, we need to disable
# the service enable flag. The service still starts but the management of
# the service with systemd errors.
if ($::os_package_type == 'debian') {
$service_enable = false
} else {
$service_enable = true
}
# 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 => $service_enable,
require => File_line['redis_config'],
}
}