Defined Type: haproxy::peers
- Defined in:
- manifests/peers.pp
Summary
This type will set up a peers entry in haproxy.cfgOverview
on the load balancer. This setting is required to share the current state of HAproxy with other HAproxy in High available configurations.
24 25 26 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 |
# File 'manifests/peers.pp', line 24
define haproxy::peers (
Boolean $collect_exported = true,
String $instance = 'haproxy',
Optional[Stdlib::Absolutepath] $config_file = undef,
) {
# We derive these settings so that the caller only has to specify $instance.
include haproxy::params
if $instance == 'haproxy' {
$instance_name = 'haproxy'
$_config_file = pick($config_file, $haproxy::config_file)
} else {
$instance_name = "haproxy-${instance}"
$_config_file = pick($config_file, inline_template($haproxy::params::config_file_tmpl))
}
# Template uses: $name
concat::fragment { "${instance_name}-${name}_peers_block":
order => "30-peers-00-${name}",
target => $_config_file,
content => epp('haproxy/haproxy_peers_block.epp', { 'name' => $name }),
}
if $collect_exported {
haproxy::peer::collect_exported { $name: }
}
# else: the resources have been created and they introduced their
# concat fragments. We don't have to do anything about them.
}
|