Puppet Class: psick::mail::postfix

Defined in:
manifests/mail/postfix.pp

Overview

This class manages the installation and configuration of postfix via tp

Parameters:

  • ensure (Enum['present','absent']) (defaults to: 'present')

    If to install or remove the postfix package

  • config_dir_source (Variant[String[1],Undef]) (defaults to: undef)

    The source to use (as used in source =>) to populate the whole postfix configuration directory

  • config_file_template (String) (defaults to: '')

    The erb template (as used in template()) to manage the content of the postfix main.cf file

  • options

    An open hash of options to use in the provided template. Note: This variable is not a class paramenter but it’s looked up with hiera_hash(‘psick::logs::postfix::options’, {} )



12
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
44
45
# File 'manifests/mail/postfix.pp', line 12

class psick::mail::postfix (
  Enum['present','absent'] $ensure                     = 'present',

  Variant[String[1],Undef] $config_dir_source          = undef,
  String                   $config_file_template       = '',
) {

  $options_default = {
    'mydomain'        => $::domain,
    'inet_interfaces' => 'localhost',
    'inet_protocols'  => 'all',
    'my_destination'  => '$myhostname, localhost.$mydomain, localhost',
  }
  $options_user=hiera_hash('psick::mail::postfix::options', {} )
  $options=merge($options_default,$options_user)

  # Postfix as local mailer
  ::tp::install { 'postfix':
    ensure => $ensure,
  }

  if $config_file_template != '' {
    ::tp::conf { 'postfix':
      ensure       => $ensure,
      template     => $config_file_template,
      options_hash => $options,
    }
  }

  ::tp::dir { 'postfix':
    ensure => $ensure,
    source => $config_dir_source,
  }
}