Debian Codegraph @

manifests/mailers.pp

raw
1 # @summary
2 # This type will set up a mailers entry in haproxy.cfg on the load balancer.
3 # @note
4 # This setting makes it possible to send emails during state changes.
5 #
6 #
7 # @param instance
8 # Optional. Defaults to 'haproxy'.
9 #
10 # @param collect_exported
11 # Boolean. Defaults to true.
12 #
13 define haproxy::mailers (
14 Boolean $collect_exported = true,
15 String $instance = 'haproxy',
16 ) {
17 # We derive these settings so that the caller only has to specify $instance.
18 include haproxy::params
19 if $instance == 'haproxy' {
20 $instance_name = 'haproxy'
21 $config_file = $haproxy::config_file
22 } else {
23 $instance_name = "haproxy-${instance}"
24 $config_file = inline_template($haproxy::params::config_file_tmpl)
25 }
26
27 $parameters = {
28 'name' => $name,
29 }
30
31 # Template uses: $name
32 concat::fragment { "${instance_name}-${name}_mailers_block":
33 order => "40-mailers-00-${name}",
34 target => $config_file,
35 content => epp('haproxy/haproxy_mailers_block.epp', $parameters),
36 }
37
38 if $collect_exported {
39 haproxy::mailer::collect_exported { $name: }
40 }
41 # else: the resources have been created and they introduced their
42 # concat fragments. We don't have to do anything about them.
43 }