puppet-openstack-integration/manifests/redis.pp
Takashi Kajinami 1668df9ec4 Remove usage of custom os_package_type fact
Currently we support usage of distro packages only, and this custom
fact can be simply replaced by the default fact.

Change-Id: I8cad680e0ec96388cf5fa0e34f50b2c4d5969523
2022-01-05 22:44:55 +09: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 ($::operatingsystem == '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'],
}
}