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 lookup(‘psick::logs::postfix::options’, {} )

  • manage (Boolean) (defaults to: $::psick::manage)
  • noop_manage (Boolean) (defaults to: $::psick::noop_manage)
  • noop_value (Boolean) (defaults to: $::psick::noop_value)


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
46
47
48
49
50
51
52
# 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       = '',
  Boolean $manage             = $::psick::manage,
  Boolean $noop_manage        = $::psick::noop_manage,
  Boolean $noop_value         = $::psick::noop_value,
) {
  if $manage {
    if $noop_manage {
      noop($noop_value)
    }
    $options_default = {
      'mydomain'        => $::domain,
      'inet_interfaces' => 'localhost',
      'inet_protocols'  => 'all',
      'my_destination'  => '$myhostname, localhost.$mydomain, localhost',
    }
    $options_user=lookup('psick::mail::postfix::options', Hash, 'deep', {} )
    $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,
    }
  }
}