dhoppe / puppet-postfix

This module installs, configures and manages the Postfix service.
Apache License 2.0
7 stars 18 forks source link

postfix

Build Status Code Coverage Puppet Forge Puppet Forge - downloads Puppet Forge - endorsement Puppet Forge - scores

Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Setup - The basics of getting started with postfix
  4. Usage - Configuration options and additional functionality
  5. Reference - An under-the-hood peek at what the module is doing and how
  6. Limitations - OS compatibility, etc.
  7. Development - Guide for contributing to the module

Overview

This module installs, configures and manages the Postfix service.

Module Description

This module handles installing, configuring and running Postfix across a range of operating systems and distributions.

Setup

What postfix affects

Setup Requirements

Beginning with postfix

Install postfix with the default parameters (No configuration files will be changed).

    class { 'postfix': }

Install postfix with the recommended parameters.

    class { 'postfix':
      config_file_template => "postfix/${::operatingsystem}/etc/postfix/main.cf.erb",
      config_file_hash     => {
        'mailname' => {
          config_file_path   => '/etc/mailname',
          config_file_string => "${::fqdn}\n",
        },
      },
    }

Usage

Update the postfix package.

    class { 'postfix':
      package_ensure => 'latest',
    }

Remove the postfix package.

    class { 'postfix':
      package_ensure => 'absent',
    }

Purge the postfix package (All configuration files will be removed).

    class { 'postfix':
      package_ensure => 'purged',
    }

Deploy the configuration files from source directory.

    class { 'postfix':
      config_dir_source => "puppet:///modules/postfix/${::operatingsystem}/etc/postfix",
    }

Deploy the configuration files from source directory (Unmanaged configuration files will be removed).

    class { 'postfix':
      config_dir_purge  => true,
      config_dir_source => "puppet:///modules/postfix/${::operatingsystem}/etc/postfix",
    }

Deploy the configuration file from source.

    class { 'postfix':
      config_file_source => "puppet:///modules/postfix/${::operatingsystem}/etc/postfix/main.cf",
    }

Deploy the configuration file from string.

    class { 'postfix':
      config_file_string => '# THIS FILE IS MANAGED BY PUPPET',
    }

Deploy the configuration file from template.

    class { 'postfix':
      config_file_template => "postfix/${::operatingsystem}/etc/postfix/main.cf.erb",
    }

Deploy the configuration file from custom template (Additional parameters can be defined).

    class { 'postfix':
      config_file_template     => "postfix/${::operatingsystem}/etc/postfix/main.cf.erb",
      config_file_options_hash => {
        'key' => 'value',
      },
    }

Deploy additional configuration files from source, string or template.

    class { 'postfix':
      config_file_hash => {
        'postfix.2nd.conf' => {
          config_file_path   => '/etc/postfix/postfix.2nd.conf',
          config_file_source => "puppet:///modules/postfix/${::operatingsystem}/etc/postfix/postfix.2nd.conf",
        },
        'postfix.3rd.conf' => {
          config_file_path   => '/etc/postfix/postfix.3rd.conf',
          config_file_string => '# THIS FILE IS MANAGED BY PUPPET',
        },
        'postfix.4th.conf' => {
          config_file_path     => '/etc/postfix/postfix.4th.conf',
          config_file_template => "postfix/${::operatingsystem}/etc/postfix/postfix.4th.conf.erb",
        },
      },
    }

Disable the postfix service.

    class { 'postfix':
      service_ensure => 'stopped',
    }

Reference

Classes

Public Classes

Private Classes

Parameters

package_ensure

Determines if the package should be installed. Valid values are 'present', 'latest', 'absent' and 'purged'. Defaults to 'present'.

package_name

Determines the name of package to manage. Defaults to 'postfix'.

package_list

Determines if additional packages should be managed. Defaults to '['swaks']'.

config_dir_ensure

Determines if the configuration directory should be present. Valid values are 'absent' and 'directory'. Defaults to 'directory'.

config_dir_path

Determines if the configuration directory should be managed. Defaults to '/etc/postfix'

config_dir_purge

Determines if unmanaged configuration files should be removed. Valid values are 'true' and 'false'. Defaults to 'false'.

config_dir_recurse

Determines if the configuration directory should be recursively managed. Valid values are 'true' and 'false'. Defaults to 'true'.

config_dir_source

Determines the source of a configuration directory. Defaults to 'undef'.

config_file_ensure

Determines if the configuration file should be present. Valid values are 'absent' and 'present'. Defaults to 'present'.

config_file_path

Determines if the configuration file should be managed. Defaults to '/etc/postfix/main.cf'

config_file_owner

Determines which user should own the configuration file. Defaults to 'root'.

config_file_group

Determines which group should own the configuration file. Defaults to 'root'.

config_file_mode

Determines the desired permissions mode of the configuration file. Defaults to '0644'.

config_file_source

Determines the source of a configuration file. Defaults to 'undef'.

config_file_string

Determines the content of a configuration file. Defaults to 'undef'.

config_file_template

Determines the content of a configuration file. Defaults to 'undef'.

config_file_notify

Determines if the service should be restarted after configuration changes. Defaults to 'Service[postfix]'.

config_file_require

Determines which package a configuration file depends on. Defaults to 'Package[postfix]'.

config_file_hash

Determines which configuration files should be managed via postfix::define. Defaults to '{}'.

config_file_options_hash

Determines which parameters should be passed to an ERB template. Defaults to '{}'.

service_ensure

Determines if the service should be running or not. Valid values are 'running' and 'stopped'. Defaults to 'running'.

service_name

Determines the name of service to manage. Defaults to 'postfix'.

service_enable

Determines if the service should be enabled at boot. Valid values are 'true' and 'false'. Defaults to 'true'.

myhostname

Determines the internet domain name of this mail system. Defaults to "$::fqdn".

mydestination

Determines the list of domains that are delivered via the $local_transport mail delivery transport. Defaults to "${::fqdn}, localhost.${::domain}, localhost".

recipient

Determines which email address should be used for the redirecting. Defaults to "admin@${::domain}".

relayhost

Determines which host should be used as relayhost for outgoing emails. Defaults to "smtp.${::domain}".

relayport

Determines which port should be used as relayhost for outgoing emails. Defaults to '25'.

sasl_user

Determines which user should be used for authentication with the relayhost. Defaults to 'undef'.

sasl_pass

Determines which password should be used for authentication with the relayhost. Defaults to 'undef'.

Limitations

This module has been tested on:

Development

Bug Report

If you find a bug, have trouble following the documentation or have a question about this module - please create an issue.

Pull Request

If you are able to patch the bug or add the feature yourself - please make a pull request.

Contributors

The list of contributors can be found at: https://github.com/dhoppe/puppet-postfix/graphs/contributors