comparison modules/apache/manifests/balancer.pp @ 437:b8d6ada284dd

Update Apache module to latest version Also converted some params to ints to match
author IBBoard <dev@ibboard.co.uk>
date Sun, 14 Aug 2022 11:30:13 +0100
parents d9352a684e62
children adf6fe9bbc17
comparison
equal deleted inserted replaced
436:6293839019d0 437:b8d6ada284dd
8 # balancer members, and then collect them on a single apache load balancer 8 # balancer members, and then collect them on a single apache load balancer
9 # server. 9 # server.
10 # 10 #
11 # @note 11 # @note
12 # Currently requires the puppetlabs/concat module on the Puppet Forge and uses 12 # Currently requires the puppetlabs/concat module on the Puppet Forge and uses
13 # storeconfigs on the Puppet Master to export/collect resources from all 13 # storeconfigs on the Puppet Server to export/collect resources from all
14 # balancer members. 14 # balancer members.
15 # 15 #
16 # @param name 16 # @param name
17 # The namevar of the defined resource type is the balancer clusters name.<br /> 17 # The namevar of the defined resource type is the balancer clusters name.<br />
18 # This name is also used in the name of the conf.d file 18 # This name is also used in the name of the conf.d file
41 # 41 #
42 # @example 42 # @example
43 # apache::balancer { 'puppet00': } 43 # apache::balancer { 'puppet00': }
44 # 44 #
45 define apache::balancer ( 45 define apache::balancer (
46 $proxy_set = {}, 46 Hash $proxy_set = {},
47 $collect_exported = true, 47 Boolean $collect_exported = true,
48 $target = undef, 48 Optional[String] $target = undef,
49 $options = [], 49 Array[Pattern[/=/]] $options = [],
50 ) { 50 ) {
51 include ::apache::mod::proxy_balancer 51 include apache::mod::proxy_balancer
52 52
53 if versioncmp($apache::mod::proxy_balancer::apache_version, '2.4') >= 0 { 53 if versioncmp($apache::mod::proxy_balancer::apache_version, '2.4') >= 0 {
54 $lbmethod = $proxy_set['lbmethod'] ? { 54 $lbmethod = $proxy_set['lbmethod'] ? {
55 undef => 'byrequests', 55 undef => 'byrequests',
56 default => $proxy_set['lbmethod'], 56 default => $proxy_set['lbmethod'],
57 } 57 }
58 ensure_resource('apache::mod', "lbmethod_${lbmethod}", { 58 ensure_resource('apache::mod', "lbmethod_${lbmethod}", {
59 'loadfile_name' => "proxy_balancer_lbmethod_${lbmethod}.load" 59 'loadfile_name' => "proxy_balancer_lbmethod_${lbmethod}.load"
60 }) 60 })
61 } 61 }
62 62
63 if $target { 63 if $target {
64 $_target = $target 64 $_target = $target
65 } else { 65 } else {
66 $_target = "${::apache::confd_dir}/balancer_${name}.conf" 66 $_target = "${apache::confd_dir}/balancer_${name}.conf"
67 } 67 }
68 68
69 if !empty($options) { 69 if !empty($options) {
70 $_options = " ${join($options, ' ')}" 70 $_options = " ${join($options, ' ')}"
71 } else { 71 } else {
72 $_options = '' 72 $_options = ''
73 } 73 }
74 74
75 concat { "apache_balancer_${name}": 75 concat { "apache_balancer_${name}":
76 owner => '0', 76 owner => 0,
77 group => '0', 77 group => 0,
78 path => $_target, 78 path => $_target,
79 mode => $::apache::file_mode, 79 mode => $apache::file_mode,
80 notify => Class['Apache::Service'], 80 notify => Class['Apache::Service'],
81 } 81 }
82 82
83 concat::fragment { "00-${name}-header": 83 concat::fragment { "00-${name}-header":
84 target => "apache_balancer_${name}", 84 target => "apache_balancer_${name}",