Defined Type: haproxy::mailers

Defined in:
manifests/mailers.pp

Summary

This type will set up a mailers entry in haproxy.cfg on the load balancer.

Overview

Note:

This setting makes it possible to send emails during state changes.

Parameters:

  • instance (String) (defaults to: 'haproxy')

    Optional. Defaults to ‘haproxy’.

  • collect_exported (Boolean) (defaults to: true)

    Boolean. Defaults to true.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'manifests/mailers.pp', line 13

define haproxy::mailers (
  Boolean $collect_exported = true,
  String  $instance         = 'haproxy',
) {
  # We derive these settings so that the caller only has to specify $instance.
  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 = {
    'name' => $name,
  }

  # Template uses: $name
  concat::fragment { "${instance_name}-${name}_mailers_block":
    order   => "40-mailers-00-${name}",
    target  => $config_file,
    content => epp('haproxy/haproxy_mailers_block.epp', $parameters),
  }

  if $collect_exported {
    haproxy::mailer::collect_exported { $name: }
  }
  # else: the resources have been created and they introduced their
  # concat fragments. We don't have to do anything about them.
}