Puppet Class: postfix

Defined in:
manifests/init.pp

Overview

Main class

Parameters:

$packages
  packagase to install
$package_ensure
  defaults to 'install'
$parameters:
  Hash of parameters for server
$services:
  Hash of services for server
  Defaults to {}
$maps:
  Hash of maps to generate
  Defaults to {}
$map_dir:
  directory for maps to create
$ssl_dir:
  directory for ssl to create

Parameters:

  • packages (Array) (defaults to: ['postfix'])
  • package_ensure (String) (defaults to: 'present')
  • parameters (Hash) (defaults to: {})
  • services (Hash) (defaults to: {})
  • maps (Hash) (defaults to: {})
  • map_dir (String) (defaults to: '/etc/postfix/maps')
  • postmap_command (String) (defaults to: '/usr/sbin/postmap')
  • ssl_dir (String) (defaults to: '/etc/postfix/ssl')
  • create_resources (Hash) (defaults to: {})
  • master_cf_file (String) (defaults to: '/etc/postfix/master.cf')
  • main_cf_file (String) (defaults to: '/etc/postfix/main.cf')
  • owner (String) (defaults to: 'root')
  • group (String) (defaults to: 'root')
  • mode (String) (defaults to: '0644')


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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'manifests/init.pp', line 22

class postfix (
  Array   $packages         = ['postfix'],
  String  $package_ensure   = 'present',
  Hash    $parameters       = {},
  Hash    $services         = {},
  Hash    $maps             = {},
  String  $map_dir          = '/etc/postfix/maps',
  String  $postmap_command  = '/usr/sbin/postmap',
  String  $ssl_dir          = '/etc/postfix/ssl',
  Hash    $create_resources = {},
  String  $master_cf_file   = '/etc/postfix/master.cf',
  String  $main_cf_file     = '/etc/postfix/main.cf',
  String  $owner            = 'root',
  String  $group            = 'root',
  String  $mode             = '0644',
) {

  Package<|tag == 'postfix-packages'|> -> File[ $map_dir, $ssl_dir ]

  $package_default = {
    ensure => $package_ensure,
    tag    => 'postfix-packages',
  }
  ensure_packages($packages, $package_default)

  file { [ $map_dir, $ssl_dir ]:
    ensure => directory,
    owner  => $owner,
    group  => $group,
    mode   => '0755',
  }

  include ::postfix::service

  class { '::postfix::config::main' :
    parameters   => $parameters,
    main_cf_file => $main_cf_file,
    owner        => $owner,
    group        => $group,
    mode         => $mode,
  }

  class { '::postfix::config::master' :
    services       => $services,
    master_cf_file => $master_cf_file,
    owner          => $owner,
    group          => $group,
    mode           => $mode,
  }

  create_resources('::postfix::map', $maps, {
    map_dir         => $map_dir,
    postmap_command => $postmap_command,
    owner           => $owner,
    group           => $group,
    mode            => $mode,
  })

  # create generic resources (eg. to retrieve certificate)
  $create_resources.each | $res, $vals | {
    create_resources($res, $vals )
  }
}