Defined Type: haproxy::defaults
- Defined in:
- manifests/defaults.pp
Summary
This type will setup a additional defaults configuration block inside the haproxy.cfg file on an haproxy load balancer.Overview
Note:
A new default configuration block resets all defaults of prior defaults configuration blocks. Listener, Backends, Frontends and Balancermember can be configured behind a default configuration block by setting the defaults parameter to the corresponding defaults name.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'manifests/defaults.pp', line 27
define haproxy::defaults (
Hash $options = {},
Boolean $sort_options_alphabetic = true,
Boolean $merge_options = $haproxy::params::merge_options,
String $instance = 'haproxy',
) {
if $instance == 'haproxy' {
include haproxy
$instance_name = 'haproxy'
$config_file = $haproxy::config_file
} else {
include haproxy::params
$instance_name = "haproxy-${instance}"
$config_file = inline_template($haproxy::params::config_file_tmpl)
}
include haproxy::globals
$_sort_options_alphabetic = pick($sort_options_alphabetic, $haproxy::globals::sort_options_alphabetic)
$defaults_options = pick($options, $haproxy::params::defaults_options)
if $merge_options {
$_defaults_options = $haproxy::params::defaults_options + $defaults_options
} else {
$_defaults_options = $defaults_options
}
$parameters = {
'_sort_options_alphabetic' => $_sort_options_alphabetic,
'options' => $_defaults_options,
'name' => $name,
}
concat::fragment { "${instance_name}-${name}_defaults_block":
order => "25-${name}",
target => $config_file,
content => epp('haproxy/haproxy_defaults_block.epp', $parameters),
}
}
|