Mercurial > repos > other > Puppet
diff modules/apache/manifests/balancer.pp @ 275:d9352a684e62
Mass update of modules to remove deprecation warnings
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 26 Jan 2020 11:36:07 +0000 |
parents | 675c1cc61eaf |
children | b8d6ada284dd |
line wrap: on
line diff
--- a/modules/apache/manifests/balancer.pp Sat Jan 04 11:42:45 2020 +0000 +++ b/modules/apache/manifests/balancer.pp Sun Jan 26 11:36:07 2020 +0000 @@ -1,51 +1,52 @@ -# == Define Resource Type: apache::balancer +# @summary +# This type will create an apache balancer cluster file inside the conf.d +# directory. # -# This type will create an apache balancer cluster file inside the conf.d -# directory. Each balancer cluster needs one or more balancer members (that can +# Each balancer cluster needs one or more balancer members (that can # be declared with the apache::balancermember defined resource type). Using # storeconfigs, you can export the apache::balancermember resources on all # balancer members, and then collect them on a single apache load balancer # server. # -# === Requirement/Dependencies: -# -# Currently requires the puppetlabs/concat module on the Puppet Forge and uses -# storeconfigs on the Puppet Master to export/collect resources from all -# balancer members. -# -# === Parameters +# @note +# Currently requires the puppetlabs/concat module on the Puppet Forge and uses +# storeconfigs on the Puppet Master to export/collect resources from all +# balancer members. # -# [*name*] -# The namevar of the defined resource type is the balancer clusters name. -# This name is also used in the name of the conf.d file +# @param name +# The namevar of the defined resource type is the balancer clusters name.<br /> +# This name is also used in the name of the conf.d file # -# [*proxy_set*] -# Hash, default empty. If given, each key-value pair will be used as a ProxySet -# line in the configuration. +# @param proxy_set +# Configures key-value pairs to be used as a ProxySet lines in the configuration. +# +# @param target +# The path to the file the balancer definition will be written in. # -# [*target*] -# String, default undef. If given, path to the file the balancer definition will -# be written. +# @param collect_exported +# Determines whether to use exported resources.<br /> +# If you statically declare all of your backend servers, set this parameter to false to rely +# on existing, declared balancer member resources. Also, use apache::balancermember with array +# arguments.<br /> +# To dynamically declare backend servers via exported resources collected on a central node, +# set this parameter to true to collect the balancer member resources exported by the balancer +# member nodes.<br /> +# If you don't use exported resources, a single Puppet run configures all balancer members. If +# you use exported resources, Puppet has to run on the balanced nodes first, then run on the +# balancer. # -# [*collect_exported*] -# Boolean, default 'true'. True means 'collect exported @@balancermember -# resources' (for the case when every balancermember node exports itself), -# false means 'rely on the existing declared balancermember resources' (for the -# case when you know the full set of balancermembers in advance and use -# apache::balancermember with array arguments, which allows you to deploy -# everything in 1 run) +# @param options +# Specifies an array of [options](https://httpd.apache.org/docs/current/mod/mod_proxy.html#balancermember) +# after the balancer URL, and accepts any key-value pairs available to `ProxyPass`. # -# -# === Examples -# -# Exporting the resource for a balancer member: -# -# apache::balancer { 'puppet00': } +# @example +# apache::balancer { 'puppet00': } # define apache::balancer ( $proxy_set = {}, $collect_exported = true, $target = undef, + $options = [], ) { include ::apache::mod::proxy_balancer @@ -54,7 +55,9 @@ undef => 'byrequests', default => $proxy_set['lbmethod'], } - ensure_resource('apache::mod', "lbmethod_${lbmethod}") + ensure_resource('apache::mod', "lbmethod_${lbmethod}", { + 'loadfile_name' => "proxy_balancer_lbmethod_${lbmethod}.load" + }) } if $target { @@ -63,6 +66,12 @@ $_target = "${::apache::confd_dir}/balancer_${name}.conf" } + if !empty($options) { + $_options = " ${join($options, ' ')}" + } else { + $_options = '' + } + concat { "apache_balancer_${name}": owner => '0', group => '0', @@ -74,7 +83,7 @@ concat::fragment { "00-${name}-header": target => "apache_balancer_${name}", order => '01', - content => "<Proxy balancer://${name}>\n", + content => "<Proxy balancer://${name}${_options}>\n", } if $collect_exported {