diff --git a/manifests/init.pp b/manifests/init.pp index 2466865..110004a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -99,6 +99,7 @@ $conf_zset_max_ziplist_value = '64', # 2.4+ $package_ensure = 'present', $package_name = undef, + $redis_version_override = undef, $service_enable = true, $service_ensure = 'running', $service_restart = true, @@ -111,6 +112,18 @@ $conf_logrotate = $redis::params::conf_logrotate $service = $redis::params::service + if $redis_version_override { + $redis_version_real = $redis_version_override + } else { + $redis_version_real = $package_ensure ? { + /2\.2\..*/ => '2.2.x', + /2\.4\..*/ => '2.4.x', + /2\.6\..*/ => '2.6.x', + /2\.8\..*/ => '2.8.x', + default => $::redis_version + } + } + if $package_name { $package = $package_name }else{ diff --git a/templates/redis.conf.erb b/templates/redis.conf.erb index 3696590..aec4179 100644 --- a/templates/redis.conf.erb +++ b/templates/redis.conf.erb @@ -1,4 +1,4 @@ -<%- if @redis_version == "2.2.x" -%> +<%- if @redis_version_real == "2.2.x" -%> # MANAGED BY PUPPET # # # Redis 2.2 configuration file example @@ -545,7 +545,7 @@ include <%= include %><%= "\n" -%> <%- end -%> <%- end -%> <%- end -%> -<%- if @redis_version == "2.4.x" -%> +<%- if @redis_version_real == "2.4.x" -%> # MANAGED BY PUPPET # # # Redis 2.4 configuration file example @@ -1174,7 +1174,7 @@ include <%= include %><%= "\n" -%> <%- end -%> <%- end -%> <%- end -%> -<%- if @redis_version == "2.6.x" -%> +<%- if @redis_version_real == "2.6.x" -%> # MANAGED BY PUPPET # # # Redis 2.6 configuration file example @@ -1903,7 +1903,7 @@ include <%= include %><%= "\n" -%> <%- end -%> <%- end -%> <%- end -%> -<%- if @redis_version == "2.8.x" -%> +<%- if @redis_version_real == "2.8.x" -%> # MANAGED BY PUPPET # # # Redis 2.8 configuration file example