|
12 | 12 | # === Parameters |
13 | 13 | # |
14 | 14 | # [*package_ensure*] |
15 | | -# Chooses whether the haproxy package should be installed or uninstalled. Defaults to 'present' |
| 15 | +# Chooses whether the haproxy package should be installed or uninstalled. |
| 16 | +# Defaults to 'present' |
16 | 17 | # |
17 | 18 | # [*package_name*] |
18 | 19 | # The package name of haproxy. Defaults to 'haproxy' |
| 20 | +# NOTE: haproxy::instance has a different default. |
19 | 21 | # |
20 | 22 | # [*service_ensure*] |
21 | 23 | # Chooses whether the haproxy service should be running & enabled at boot, or |
22 | 24 | # stopped and disabled at boot. Defaults to 'running' |
23 | 25 | # |
24 | 26 | # [*service_manage*] |
25 | | -# Chooses whether the haproxy service state should be managed by puppet at all. Defaults to true |
| 27 | +# Chooses whether the haproxy service state should be managed by puppet at |
| 28 | +# all. Defaults to true |
| 29 | +# |
| 30 | +# [*service_options*] |
| 31 | +# Contents for the `/etc/defaults/haproxy` file on Debian. Defaults to "ENABLED=1\n" on Debian, and is ignored on other systems. |
| 32 | +# |
| 33 | +# [*service_options*] |
| 34 | +# Contents for the `/etc/defaults/haproxy` file on Debian. Defaults to "ENABLED=1\n" on Debian, and is ignored on other systems. |
26 | 35 | # |
27 | 36 | # [*service_options*] |
28 | 37 | # Contents for the `/etc/defaults/haproxy` file on Debian. Defaults to "ENABLED=1\n" on Debian, and is ignored on other systems. |
|
39 | 48 | # options as an array and you will get a line for each of them in the |
40 | 49 | # resultant haproxy.cfg file. |
41 | 50 | # |
| 51 | +# [*merge_options*] |
| 52 | +# Whether to merge the user-supplied `global_options`/`defaults_options` |
| 53 | +# hashes with their default values set in params.pp. Merging allows to change |
| 54 | +# or add options without having to recreate the entire hash. Defaults to |
| 55 | +# false, but will default to true in future releases. |
| 56 | +# |
42 | 57 | #[*restart_command*] |
43 | 58 | # Command to use when restarting the on config changes. |
44 | 59 | # Passed directly as the <code>'restart'</code> parameter to the service resource. |
|
86 | 101 | $package_name = $haproxy::params::package_name, |
87 | 102 | $service_ensure = 'running', |
88 | 103 | $service_manage = true, |
89 | | - $service_options = "ENABLED=1\n", |
| 104 | + $service_options = $haproxy::params::service_options, |
90 | 105 | $global_options = $haproxy::params::global_options, |
91 | 106 | $defaults_options = $haproxy::params::defaults_options, |
| 107 | + $merge_options = $haproxy::params::merge_options, |
92 | 108 | $restart_command = undef, |
93 | 109 | $custom_fragment = undef, |
94 | 110 | $config_file = $haproxy::params::config_file, |
|
105 | 121 | } |
106 | 122 | validate_string($package_name,$package_ensure) |
107 | 123 | validate_bool($service_manage) |
| 124 | + validate_bool($merge_options) |
108 | 125 | validate_string($service_options) |
109 | 126 |
|
| 127 | + # NOTE: These deprecating parameters are implemented in this class, |
| 128 | + # not in haproxy::instance. haproxy::instance is new and therefore |
| 129 | + # there should be no legacy code that uses these deprecated |
| 130 | + # parameters. |
| 131 | + |
110 | 132 | # To support deprecating $enable |
111 | 133 | if $enable != undef { |
112 | 134 | warning('The $enable parameter is deprecated; please use service_ensure and/or package_ensure instead') |
|
130 | 152 | $_service_manage = $service_manage |
131 | 153 | } |
132 | 154 |
|
133 | | - if $_package_ensure == 'absent' or $_package_ensure == 'purged' { |
134 | | - anchor { 'haproxy::begin': } |
135 | | - ~> class { 'haproxy::service': } |
136 | | - -> class { 'haproxy::config': } |
137 | | - -> class { 'haproxy::install': } |
138 | | - -> anchor { 'haproxy::end': } |
139 | | - } else { |
140 | | - anchor { 'haproxy::begin': } |
141 | | - -> class { 'haproxy::install': } |
142 | | - -> class { 'haproxy::config': } |
143 | | - ~> class { 'haproxy::service': } |
144 | | - -> anchor { 'haproxy::end': } |
| 155 | + haproxy::instance{ $title: |
| 156 | + package_ensure => $_package_ensure, |
| 157 | + package_name => $package_name, |
| 158 | + service_ensure => $_service_ensure, |
| 159 | + service_manage => $_service_manage, |
| 160 | + global_options => $global_options, |
| 161 | + defaults_options => $defaults_options, |
| 162 | + restart_command => $restart_command, |
| 163 | + custom_fragment => $custom_fragment, |
| 164 | + config_file => $config_file, |
| 165 | + merge_options => $merge_options, |
| 166 | + service_options => $service_options, |
145 | 167 | } |
| 168 | + |
146 | 169 | } |
0 commit comments