summaryrefslogtreecommitdiff
path: root/manifests/mx.pp
blob: 4404a83cb1dc1ed28fd95a15d00e9fae2c0bc3ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# = Definition: bind::mx
# Creates an MX record.
#
# Arguments:
#  *$zone*:     Bind::Zone name
#  *$owner*:    owner of the Resource Record
#  *$priority*: MX record priority
#  *$host*:     target of the Resource Record
#  *$ttl*:      Time to Live for the Resource Record. Optional.
#
define bind::mx (
  $zone,
  $host,
  $priority,
  $ensure = present,
  $owner  = false,
  $ttl    = false
) {

  if $owner {
    $_owner = $owner
  } else {
    $_owner = $name
  }

  concat::fragment {"bind.${name}":
    ensure  => $ensure,
    target  => "/etc/bind/pri/${zone}.conf",
    content => template('bind/mx-record.erb'),
    notify  => Service['bind9'],
    require => [Bind::Zone[$zone], Bind::A[$host]],
  }

}