Defined Type: haproxy::mailer
- Defined in:
- manifests/mailer.pp
Summary
This type will set up a mailer entry inside the mailers configuration block in haproxy.cfg on the load balancer.Overview
Note:
Currently, it has the ability to specify the instance name, ip address, ports and server_names. Automatic discovery of mailer nodes may be implemented by exporting the mailer resource for all HAProxy balancer servers that are configured in the same HA block and then collecting them on all load balancers.
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/mailer.pp', line 35
define haproxy::mailer (
String $mailers_name,
Variant[String, Stdlib::Port] $port,
Variant[String[1], Array] $server_names = $facts['networking']['hostname'],
Variant[String, Array] $ipaddresses = $facts['networking']['ip'],
String $instance = 'haproxy',
) {
include haproxy::params
if $instance == 'haproxy' {
$instance_name = 'haproxy'
$config_file = $haproxy::config_file
} else {
$instance_name = "haproxy-${instance}"
$config_file = inline_template($haproxy::params::config_file_tmpl)
}
$parameters = {
'ipaddresses' => $ipaddresses,
'server_names' => $server_names,
'port' => $port,
}
# Templates uses $ipaddresses, $server_name, $ports, $option
concat::fragment { "${instance_name}-mailers-${mailers_name}-${name}":
order => "40-mailers-01-${mailers_name}-${name}",
target => $config_file,
content => epp('haproxy/haproxy_mailer.epp', $parameters),
}
}
|