Puppet Class: postfix

Defined in:
manifests/init.pp

Summary

Fully manages postfix.

Overview

This module fully manages postfix. It can install, uninstall, and version- pin postifx; configure or delete every vendor and custom configuration file; and optionally manage the postfix service.

Examples:

Minimum configuration, sufficient for vendor-specified defaults

---
classes:
  - postfix

Minimally install Postfix 3 with PCRE and MySQL support

# This fictional upstream repository uses the name 'postfix' for Postfix
# version 2.x and a different name, 'postfix3', for Postfix 3 packages.  Both
# use the same service name, 'postfix' (the default).
---
classes:
  - postfix

postfix::package_name: postfix3

# You MUST disable purge_config_file_path for Postfix 3, for now.  If you
# fail to do so, some important -- unmanaged -- configuration files will be
# destroyed.
postfix::purge_config_file_path: false

# Add Postfix plugin support for PCRE and MySQL
postfix::plugin_packages:
  postfix3-pcre: {}
  postfix3-mysql: {}

Parameters:

  • check_files (Optional[Hash[ String[2], Array[String[2]] ]]) (defaults to: undef)

    Set of configuration files that serve as local lookup tables for postfix *_check rules (e.g.: header_checks, body_checks, and such). The structure of this Hash is as follows:
      FILENAME:
        - CHECK_RULE
        - …
      …
    Default is found in the data directory of this module's source and is applied per this module's hiera.yaml.

  • config_file_attributes (Hash[String[4], Any])

    Set of attributes to apply to all configuration files that are managed by this module. These are file resource attributes, per: docs.puppet.com/puppet/latest/types/file.html#file-attributes Default is found in the data directory of this module's source and is applied per this module's hiera.yaml.

  • config_file_path (String[3])

    Fully-qualified path to where the Postfix configuration files are stored. Default is found in the data directory of this module's source and is applied per this module's hiera.yaml.

  • config_file_path_attributes (Hash[String[4], Any])

    Puppet attributes applied to config_file_path. Default is found in the data directory of this module's source and is applied per this module's hiera.yaml. Default is found in the data directory of this module's source and is applied per this module's hiera.yaml.

  • config_files (Optional[Hash[ String[2], Hash[ Pattern[/^-*[A-Za-z0-9_]+$/], Any ]]]) (defaults to: undef)

    Excluding master.cf (controlled via master_processes) and main.cf (controlled via global_parameters), this is a set of additional configuration files for Postfix. Such files are typically lookup configurations for external services like MySQL, PostgreSQL, and such. This Hash has structure:
      FILENAME:
        KEY: VALUE
        …
      …
    Default is found in the data directory of this module's source and is applied per this module's hiera.yaml.

  • config_hash_key_knockout_prefix (Pattern[/^-+$/])

    String of - characters which, when present as a prefix to any supporting Hash key, will cause that entire key and its value to be removed from the resulting rendered configuration file. This is limited to one or more hyphen (-) characters because the matching patterns for the keys users would likely must assume a pre-known value for this parameter and one or more hyphens seems most reasonable. Default is found in the data directory of this module's source and is applied per this module's hiera.yaml.

  • global_parameters (Hash[ Pattern[/^-*[A-Za-z0-9_]+$/], Variant[String, Integer] ])

    Full content of main.cf as a Hash with structure:
      KEY: VALUE
      …
    Default is found in the data directory of this module's source and is applied per this module's hiera.yaml. <strong>NOTE</strong>: When using Postfix 3+, you must set an appropriate compatibility_level.

  • master_processes (Hash[ Pattern[/^-*[a-z]+\/(inet|unix|fifo|pass)$/], Struct[{ command => String[2], Optional['private'] => Enum['y', 'n'], Optional['unpriv'] => Enum['y', 'n'], Optional['chroot'] => Enum['y', 'n'], Optional['wakeup'] => Variant[Pattern[/^(0|[1-9][0-9]*)\??$/], Integer], Optional['maxproc'] => Integer, }]])

    Full content of master.cf as a Hash with structure:
      service-name/service-type:
        command: command name and its arguments
        private: OPTIONAL, y or n
        unpriv: OPTIONAL, y or n
        chroot: OPTIONAL, y or n
        wakeup: OPTIONAL, any positive number; may end with ?
        maxproc: OPTIONAL, any positive number
      …
    Default is found in the data directory of this module's source and is applied per this module's hiera.yaml.

  • package_ensure (String)

    Precise version number of the postfix package to install (and lock-in, blocking up/downgrades) or any Puppet token value to more generically control the installed package version or to uninstall postfix, optionally purging all postfix configuration files. By default, this package is merely installed without any up/downgrade management.

  • package_name (String[2])

    Name of the primary postfix package to manage, per your operating system and distribution. Default is found in the data directory of this module's source and is applied per this module's hiera.yaml.

  • plugin_packages (Optional[Hash[ Pattern[/^postfix.*-.+$/], Struct[{ Optional['ensure'] => String[1], Optional['provider'] => String[1], Optional['source'] => String[1], }]]]) (defaults to: undef)

    Hash describing additional postfix packages to install. This is necessary for Postfix 3+ where features like MySQL or PgSQL are enabled by which of these additional plugin_packages are installed along with Postfix. Such plugin packages are typically named like “postfix-mysql” or “postfix3-mysql”, depending on your upstream repositories' naming conventions. This Hash has structure:
      /^postfix.*-.+$/:
        ensure: OPTIONAL, ”>puppet.com/docs/puppet/latest/types/package.html#package-attribute-provider
        source: OPTIONAL, (defaults to: undef) —

  • virtual_delivery_dir_attributes (Optional[Hash[String[1], Any]]) (defaults to: undef)

See Also:



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'manifests/init.pp', line 143

class postfix(
  Hash[String[4], Any]           $config_file_attributes,
  String[3]                      $config_file_path,
  Hash[String[4], Any]           $config_file_path_attributes,
  Pattern[/^-+$/]                $config_hash_key_knockout_prefix,
  Hash[
    Pattern[/^-*[A-Za-z0-9_]+$/],
    Variant[String, Integer]
  ]                              $global_parameters,
  Hash[
    Pattern[/^-*[a-z]+\/(inet|unix|fifo|pass)$/],
    Struct[{
      command             => String[2],
      Optional['private'] => Enum['y', 'n'],
      Optional['unpriv']  => Enum['y', 'n'],
      Optional['chroot']  => Enum['y', 'n'],
      Optional['wakeup']  => Variant[Pattern[/^(0|[1-9][0-9]*)\??$/], Integer],
      Optional['maxproc'] => Integer,
  }]]                            $master_processes,
  String                         $package_ensure,
  String[2]                      $package_name,
  Boolean                        $purge_config_file_path,
  Boolean                        $service_enable,
  Enum['running', 'stopped']     $service_ensure,
  Boolean                        $service_managed,
  String[2]                      $service_name,
  Optional[Hash[
    String[2],
    Array[String[2]]
  ]]                             $check_files                     = undef,
  Optional[Hash[
    String[2],
    Hash[
      Pattern[/^-*[A-Za-z0-9_]+$/],
      Any
  ]]]                            $config_files                    = undef,
  Optional[Hash[
    Pattern[/^postfix.*-.+$/],
    Struct[{
      Optional['ensure']   => String[1],
      Optional['provider'] => String[1],
      Optional['source']   => String[1],
  }]]]                           $plugin_packages                 = undef,
  Optional[Stdlib::Absolutepath] $virtual_delivery_dir            = undef,
  Optional[Hash[String[1], Any]] $virtual_delivery_dir_attributes = undef,
) {
  class { '::postfix::package': }
  -> class { '::postfix::config': }
  ~> class { '::postfix::service': }
  -> Class['postfix']
}