Skip to content
Snippets Groups Projects
Commit df15f75b authored by Benjamin Kübler's avatar Benjamin Kübler
Browse files

Documentation with puppet-strings support

parent 1cdc9ac2
No related branches found
No related tags found
No related merge requests found
Showing with 1712 additions and 831 deletions
# Postfix Puppet Module # Postfix Puppet Module
[![License](https://img.shields.io/github/license/voxpupuli/puppet-postfix.svg)](https://github.com/voxpupuli/puppet-postfix/blob/master/LICENSE)
[![Puppet Forge Version](http://img.shields.io/puppetforge/v/puppet/postfix.svg)](https://forge.puppetlabs.com/puppet/postfix) [![Puppet Forge Version](http://img.shields.io/puppetforge/v/puppet/postfix.svg)](https://forge.puppetlabs.com/puppet/postfix)
[![Puppet Forge Downloads](http://img.shields.io/puppetforge/dt/puppet/postfix.svg)](https://forge.puppetlabs.com/puppet/postfix) [![Puppet Forge Downloads](http://img.shields.io/puppetforge/dt/puppet/postfix.svg)](https://forge.puppetlabs.com/puppet/postfix)
[![Build Status](https://img.shields.io/travis/voxpupuli/puppet-postfix/master.svg)](https://travis-ci.org/voxpupuli/puppet-postfix) [![Build Status](https://github.com/voxpupuli/puppet-postfix/workflows/CI/badge.svg)](https://github.com/voxpupuli/puppet-postfix/actions?query=workflow%3ACI)
[![Donated by Camptocamp](https://img.shields.io/badge/donated%20by-camptocamp-fb7047.svg)](#transfer-notice) [![Donated by Camptocamp](https://img.shields.io/badge/donated%20by-camptocamp-fb7047.svg)](#transfer-notice)
This module requires Augeas. ## Features
## Simple usage * Configure postfix as mta or satellite
```puppet * Support for amavis scanner config
include postfix * Dovecot as the local delivery agent config
* Support Schleuder GPG-enabled mailing list
* Sympa mailing list management software
* Support for mailman
* Support for LDAP
postfix::config { 'relay_domains': ## Supported OS
ensure => present,
value => 'localhost host.foo.com',
}
```
## Classes * Ubuntu
* Debian
* CentOS
* RedHat
* Alpine
* Fedora
* FreeBSD
### postfix ## Dependencies
- [camptocamp-augeas 1.0.0+](https://github.com/camptocamp/puppet-augeas)
- [puppet-alternatives 2.0.0+](https://github.com/voxpupuli/puppet-alternatives)
- [puppetlabs-mailalias_core 1.0.5+](https://github.com/puppetlabs/puppetlabs-mailalias_core)
- [puppetlabs-stdlib 4.13.0+](https://github.com/puppetlabs/puppetlabs-stdlib)
The top-level class, to install and configure Postfix. ## Puppet
#### Parameters The supported Puppet versions are listed in the [metadata.json](metadata.json)
##### `alias_maps` ## REFERENCES
A string defining the location of the alias map file. Please see [REFERENCE.md](https://github.com/voxpupuli/puppet-postfix/blob/master/REFERENCE.md) for more details.
Default: 'hash:/etc/aliases'.
Example: 'hash:/etc/other_aliases'.
##### `configs`
A hash containing optional configuration values for main.cf. The values are configured using postfix::config.
Default: An empty hash.
Example: '{message_size_limit': {'value': '51200000'}}.
##### `inet_interfaces`
A string defining the network interfaces that Postfix will listen on.
Default: 'all'.
Example: '127.0.0.1, [::1]'.
##### `inet_protocols`
A string defining the internet protocols that Postfix will use.
Default: 'all'.
Example: 'ipv4'.
##### `ldap`
A Boolean defining whether to configure Postfix for LDAP use.
Default: false.
##### `ldap_base`
A string defining the LDAP search base to use. This parameter maps to the search_base parameter (ldap_table(5)).
Default: Undefined.
Example 'cn=Users,dc=example,dc=com'.
##### `ldap_host`
A string defining the LDAP host. This parameter maps to the server_host parameter (ldap_table(5)).
Default: Undefined.
Example: 'ldaps://ldap.example.com:636 ldap://ldap2.example.com'.
##### `ldap_options`
A free form string that can define any ldap options to be passed through (ldap_table(5)).
Default: Undefined.
Example: 'start_tls = yes'.
##### `mail_user`
A string defining the mail user, and optionally group, to execute external commands as. This parameter maps to the user parameter (pipe(8)).
Default: 'vmail'.
Example: 'vmail:vmail'.
##### `mailman`
A Boolean defining whether to configure a basic smtp server that is able to work for the mailman mailing list manager.
Default: false.
##### `maincf_source`
A string defining the location of a skeleton main.cf file to be used. The default file supplied is blank. However, if the main.cf file already exists on the system the contents will **NOT** be replaced by the contents from maincf_source.
Default: "puppet:///modules/${module_name}/main.cf".
Example: 'puppet:///modules/some/other/location/main.cf'.
##### `manage_conffiles`
A Boolean defining whether the puppet module should replace the configuration files for postfix.
**This setting currently effects only the following files:**
* /etc/mailname
* /etc/postfix/master.cf
**This setting does NOT effect the following files:**
* /etc/aliases
* /etc/postfix/main.cf
Default: true.
##### `manage_mailname`
A Boolean defining whether the puppet module should manage '/etc/mailname'.
See also $manage_conffiles
Default: true.
##### `manage_mailx`
A Boolean defining whether the puppet module should manage the mailx package. See also $mailx_ensure.
Default: true.
##### `masquerade_classes`
An array defining the masquerade_classes to use.
Default: Undefined.
Example: ['envelope_sender', 'envelope_recipient', 'header_sender', 'header_recipient']
##### `masquerade_domains`
An array defining the masquerade_domains to use.
The order of elements matters here, so be aware of how you define the elements.
Default: Undefined.
Example: ['foo.example.com', 'example.com']
##### `masquerade_exceptions`
An array defining the masquerade_exceptions to use.
Default: Undefined.
Example: ['root']
##### `mastercf_source`
A string defining the location of a skeleton master.cf file to be used.
Default: Undefined.
Example: 'puppet:///modules/some/other/location/master.cf'.
##### `master_smtp`
A string to define the smtp line in the /etc/postfix/master.cf file. If this is defined the smtp_listen parameter will be ignored.
Default: Undefined.
Example: 'smtp inet n - n - - smtpd'.
##### `master smtps`
A string to define the smtps line in the /etc/postfix/master.cf file.
Default: Undefined.
Example: 'smtps inet n - n - - smtpd'.
##### `master_submission`
A string to define the submission line in the /etc/postfix/master.cf file.
Default: Undefined.
Example: 'submission inet n - n - - smtpd'.
##### `master_entries`
Array of strings containing additional entries for the /etc/postfix/master.cf file.
Default: Undefined.
Example: 'submission inet n - n - - smtpd'.
##### `mta`
A Boolean to define whether to configure Postfix as a mail transfer agent. This option is mutually exclusive with the satellite Boolean.
Default: False.
##### `mydestination`
A string to define the mydestination parameter in main.cf (postconf(5)).
Default: The systems FQDN.
Example: 'example.com, foo.example.com'.
##### `mynetworks`
A string to define the mynetworks parameter that holds trusted remote smtp clients (postconf(5)).
Default: '127.0.0.0/8'.
Example: '127.0.0.0/8, [::1]/128'.
##### `myorigin`
A string to define the myorigin parameter that holds the domain name that mail appears to come from (postconf(5)).
Default: The FQDN of the host.
Example: 'example.com'
##### `relayhost`
A string to define the relayhost parameter (postconf(5)).
Default: Undefined.
Example: 'smtp.example.com'.
##### `root_mail_recipient`
A string to define the e-mail address to which all mail directed to root should go (aliases(5)).
Default: 'nobody'.
Example: 'root_catch@example.com'.
##### `chroot`
A boolean to define if postfix should be run in a chroot jail or not. If not defined, '-' is used (OS dependant)
Default: Undefined.
Example: true
##### `satellite`
A Boolean to define whether to configure postfix as a satellite relay host. This setting is mutually exclusive with the mta Boolean.
Default: False.
##### `smtp_listen`
A string or an array of strings to define the IPs on which to listen in master.cf. This can also be set to 'all' to listen on all interfaces. If master_smtp is defined smtp_listen will not be used.
Default: '127.0.0.1'.
Example: '::1'.
##### `use_amavisd`
A Boolean to define whether to configure master.cf to allow the use of the amavisd scanner.
Default: False.
##### `use_dovecot_lda`
A Boolean to define whether to configure master.cf to use dovecot as the local delivery agent.
Default: False.
##### `use_schleuder`
A Boolean to define whether to configure master.cf to use the Schleuder GPG-enabled mailing list.
Default: False.
##### `use_sympa`
A Boolean to define whether to configure master.cf to use the Sympa mailing list management software.
Default: False.
#### Examples
##### Include
```puppet
include postfix
```
or
##### Class Resource
```puppet
class { 'postfix':
inet_interfaces => 'localhost',
inet_protocols => 'ipv4',
relayhost => "mail.${facts['domain']}",
root_mail_recipient => 'dont_bother_the_sysadmins@example.com',
}
```
### postfix::config
Add/alter/remove options in Postfix main configuration file (main.cf). This uses Augeas to do the editing of the configuration file, as such any configuration value can be used.
#### Parameters
##### `ensure`
A string whose value can be any of 'present', 'absent', 'blank'.
Default: present.
Example: blank.
##### `value`
A string that can contain any text to be used as the configuration value.
Default: Undefined.
Example: 'btree:${data_directory}/smtp_tls_session_cache'.
#### Examples
##### Configure Postfix to use TLS as a client
```puppet
postfix::config {
'smtp_tls_mandatory_ciphers': value => 'high';
'smtp_tls_security_level': value => 'secure';
'smtp_tls_CAfile': value => '/etc/pki/tls/certs/ca-bundle.crt';
'smtp_tls_session_cache_database': value => 'btree:${data_directory}/smtp_tls_session_cache';
}
```
##### Configure Postfix to disable the vrfy command
```puppet
postfix::config { 'disable_vrfy_command':
ensure => present,
value => 'yes',
}
```
### postfix::hash
Creates Postfix hashed "map" files, and builds the corresponding db file.
#### Parameters
##### `ensure`
Defines whether the hash map file is present or not. Value can either be present or absent.
Default: present.
Example: absent.
##### `content`
A free form string that defines the contents of the file. This parameter is mutually exclusive with the source parameter.
Default: Undefined.
Example: '#Destination Credentials\nsmtp.example.com gssapi:nopassword'.
##### `source`
A string whose value is a location for the source file to be used. This parameter is mutually exclusive with the content parameter, one or the other must be present, but both cannot be present.
Default: Undefined.
Example: 'puppet:///modules/some/location/sasl_passwd'.
#### Examples
##### Create a sasl_passwd hash from a source file
```puppet
postfix::hash { '/etc/postfix/sasl_passwd':
ensure => 'present',
source => 'puppet:///modules/profile/postfix/client/sasl_passwd',
}
```
##### Create a sasl_passwd hash with contents defined in the manifest
```puppet
postfix::hash { '/etc/postfix/sasl_passwd':
ensure => 'present',
content => '#Destination Credentials\nsmtp.example.com gssapi:nopassword',
}
```
### postfix::transport
Manages content of the /etc/postfix/transport map.
#### Requirements
Augeas is, of course, required.
The following code is required to use transport maps.
```puppet
include postfix
postfix::hash { '/etc/postfix/transport':
ensure => present,
}
postfix::config { 'transport_maps'
ensure => present,
value => 'hash:/etc/postfix/transport',
}
```
#### Parameters
##### `ensure`
Defines whether the transport entry is present or not. Value can either be present or absent.
Default: present.
Example: absent.
##### `destination`
The destination to be delivered to (transport(5)).
Default: Undefined.
Example: 'mailman'.
##### `nexthop`
A string to define where and how to deliver the mail (transport(5)).
Default: Undefined.
Example: '[smtp.google.com]:25'.
#### Examples
### postfix::virtual
Manages the contents of the virtual map.
#### Requirements
Augeas is, of course, required.
The following code is necessary to make virtual maps work:
```puppet
include postfix
postfix::hash { '/etc/postfix/virtual':
ensure => present,
}
postfix::config { 'virtual_alias_maps':
ensure => present,
value => 'hash:/etc/postfix/virtual',
}
```
#### Parameters
##### `ensure`
A string whose valid values are present or absent.
Default: present.
Example: absent.
##### `file`
A string defining the location of the virtual map, pre hash.
Default: '/etc/postfix/virtual'.
Example: '/etc/postfix/my_virtual_map'.
##### `destination`
A string defining where the e-mails will be delivered to, (virtual(8)).
Default: Undefined.
Example: 'root'
#### Examples
##### Route mail bound for 'user@example.com' to root.
```puppet
postfix::virtual {'user@example.com':
ensure => present,
destination => 'root',
}
```
### postfix::conffile
Manages postfix configuration files. With it, you could create configuration files (other than, main.cf, master.cf, etc.) restarting postfix when necessary.
#### Parameters
##### `ensure`
A string whose valid values are present, absent or directory.
Default: present.
Example: absent.
##### `source`
A string with the source of the file. This is the `source` parameter of the underlying file resource.
Default: `undef`
Example: 'puppet:///modules/postfix/configfile.cf'
##### `content`
The content of the postfix configuration file. This is an alternative to the `source` parameter. If you don't provide `source` neither `content` parameters a default template is used and the content is created with values in the `options` hash.
Default: `undef`
##### `path`
Path where to create the configuration file.
Default: '/etc/postfix/${name}'
##### `mode`
Permissions of the configuration file. This option is useful if you want to create the file with specific permissions (for example, because you have passwords in it).
Default: '0644'
Example: '0640'
##### `options`
Hash with the options used in the default template that is used when neither `source` neither `content`parameters are provided.
Default: {}
Example:
```
postfix::conffile { 'ldapoptions.cf':
options => {
server_host => ldap.mydomain.com,
bind => 'yes',
bind_dn => 'cn=admin,dc=mydomain,dc=com',
bind_pw => 'password',
search_base => 'dc=example, dc=com',
query_filter => 'mail=%s',
result_attribute => 'uid',
}
}
```
## Contributing ## Contributing
......
This diff is collapsed.
#class postfix::augeas # @summary Provides augeas lenses for postfix files
#
# This class provides the augeas lenses used by the postfix class # This class provides the augeas lenses used by the postfix class
# #
# @api private
#
class postfix::augeas { class postfix::augeas {
assert_private()
$module_path = get_module_path($module_name) $module_path = get_module_path($module_name)
augeas::lens { 'postfix_transport': augeas::lens { 'postfix_transport':
ensure => present, ensure => present,
......
#== Definition: postfix::canonical # @summary Manage content of the postfix canonical map
# #
#Manages content of the /etc/postfix/canonical map. # This type manages content of the /etc/postfix/canonical map.
#
#Parameters:
#- *name*: name of address postfix will lookup. See canonical(5).
#- *destination*: where the emails will be delivered to. See canonical(5).
#- *ensure*: present/absent, defaults to present.
#
#Requires:
#- Class["postfix"]
#- Postfix::Hash["/etc/postfix/canonical"]
#- Postfix::Config["canonical_maps"] or Postfix::Config["sender_canonical_maps"] or Postfix::Config["recipient_canonical_maps"]
#- augeas
#
#Example usage:
#
# node "toto.example.com" {
# #
# @example Basic usage and required setup
# # This defined type requires the following resources:
# # - Class["postfix"]
# # - Postfix::Hash["/etc/postfix/canonical"]
# # - Postfix::Config["canonical_maps"] or Postfix::Config["sender_canonical_maps"] or Postfix::Config["recipient_canonical_maps"]
# include postfix # include postfix
#
# postfix::hash { "/etc/postfix/recipient_canonical": # postfix::hash { "/etc/postfix/recipient_canonical":
# ensure => present, # ensure => present,
# } # }
...@@ -31,12 +20,23 @@ ...@@ -31,12 +20,23 @@
# ensure => present, # ensure => present,
# destination => "root"; # destination => "root";
# } # }
# } #
# @param ensure
# Intended state of the resource
#
# @param destination
# Where the emails will be delivered to.
#
# @param file
# Where to create the file. If not defined "${postfix::confdir}/canonical"
# will be used as path.
#
# @see https://www.postfix.org/canonical.5.html
# #
define postfix::canonical ( define postfix::canonical (
$destination, String $destination,
$file=undef, Enum['present','absent'] $ensure = 'present',
$ensure='present' Stdlib::Absolutepath $file = undef
) { ) {
include postfix include postfix
include postfix::augeas include postfix::augeas
......
# = Define: postfix::conffile # @summary Manage a postfix configuration file
# #
# Adds a postfix configuration file. # Manages postfix configuration files. With it, you could create configuration
# It is mainly a file resource that also restarts postfix # files (other than, main.cf, master.cf, etc.) restarting postfix when necessary.
# #
# == Parameters # @example Simple config file with module source
# # postfix::conffile { 'ldapoptions.cf':
# [*ensure*] # source => 'puppet:///modules/postfix/ldapoptions.cf',
# Ensure parameter for the file resource. Defaults to 'present' # }
#
# [*source*]
# Sets the value of the source parameter for the file
#
# [*content*]
# Sets the content of the postfix config file
# Note: This option is alternative to the source one
#
# [*path*]
# Where to create the file.
# Defaults to "/etc/postfix/${name}".
#
# [*mode*]
# The file permissions of the file.
# Defaults to 0640
#
# [*options*]
# Hash with options to use in the template
#
# [*show_diff*]
# Boolean that sets File show_diff parameter
# #
# == Usage: # @example With template options
# postfix::conffile { 'ldapoptions.cf': # postfix::conffile { 'ldapoptions.cf':
# options => { # options => {
# server_host => <ldapserver>, # server_host => ldap.mydomain.com,
# bind => 'yes', # bind => 'yes',
# bind_dn => <bind_dn>, # bind_dn => 'cn=admin,dc=mydomain,dc=com',
# bind_pw => <bind_pw>, # bind_pw => 'password',
# search_base => 'dc=example, dc=com', # search_base => 'dc=example, dc=com',
# query_filter => 'mail=%s', # query_filter => 'mail=%s',
# result_attribute => 'uid', # result_attribute => 'uid',
# } # }
# } # }
# #
# postfix::conffile { 'ldapoptions.cf': # @param ensure
# source => 'puppet:///modules/postfix/ldapoptions.cf', # A string whose valid values are present, absent or directory.
# } #
# @param source
# A string with the source of the file. This is the `source` parameter of the underlying file resource.
# Example: `puppet:///modules/postfix/configfile.cf`
#
# @param content
# The content of the postfix configuration file. This is an alternative to the `source` parameter.
# If you don't provide `source` neither `content` parameters a default template is used and the
# content is created with values in the `options` hash.
#
# @param path
# Where to create the file. If not defined "${postfix::confdir}/${name}" will be used as path.
#
# @param mode
# Permissions of the configuration file. This option is useful if you want to create the file with
# specific permissions (for example, because you have passwords in it).
# Example: `0640`
#
# @param options
# Hash with the options used in the default template that is used when neither `source`
# neither `content`parameters are provided.
#
# @param show_diff
# Switch to set file show_diff parameter
# #
define postfix::conffile ( define postfix::conffile (
Enum['present', 'absent', 'directory'] $ensure = 'present', Enum['present', 'absent', 'directory'] $ensure = 'present',
......
# @summary Set values in postfix config file
# #
# == Definition: postfix::config # Add/alter/remove options in Postfix main configuration file (main.cf).
# # This uses Augeas to do the editing of the configuration file, as such any
# Uses Augeas to add/alter/remove options in postfix main # configuration value can be used.
# configuation file (/etc/postfix/main.cf).
#
# TODO: make this a type with an Augeas and a postconf providers.
#
# === Parameters
#
# [*name*] - name of the parameter.
# [*ensure*] - present/absent/blank. defaults to present.
# [*value*] - value of the parameter.
#
# === Requires
#
# - Class["postfix"]
#
# === Examples
# #
# @example Set value for smtp_use_tls
# postfix::config { 'smtp_use_tls': # postfix::config { 'smtp_use_tls':
# ensure => 'present', # ensure => 'present',
# value => 'yes', # value => 'yes',
# } # }
# #
# @example Set a config parameter with empty value
# postfix::config { 'relayhost': # postfix::config { 'relayhost':
# ensure => 'blank', # ensure => 'blank',
# } # }
# #
# @example Configure Postfix to use TLS as a client
# postfix::config {
# 'smtp_tls_mandatory_ciphers': value => 'high';
# 'smtp_tls_security_level': value => 'secure';
# 'smtp_tls_CAfile': value => '/etc/pki/tls/certs/ca-bundle.crt';
# 'smtp_tls_session_cache_database': value => 'btree:${data_directory}/smtp_tls_session_cache';
# }
#
# @example Configure Postfix to disable the vrfy command
# postfix::config { 'disable_vrfy_command':
# ensure => present,
# value => 'yes',
# }
#
# @param ensure
# Defines if the config parameter is present, absent or blank.
# The special value 'blank', will clear the value for the parameter,
# but will not remove it from the config file.
# Example: `blank`
#
# @param value
# A string that can contain any text to be used as the configuration value.
# Example: `btree:${data_directory}/smtp_tls_session_cache`.
#
define postfix::config ( define postfix::config (
Optional[String] $value = undef, Optional[String] $value = undef,
Enum['present', 'absent', 'blank'] $ensure = 'present', Enum['present', 'absent', 'blank'] $ensure = 'present',
...@@ -58,6 +70,7 @@ define postfix::config ( ...@@ -58,6 +70,7 @@ define postfix::config (
} }
} }
# TODO: make this a type with an Augeas and a postconf providers.
augeas { "manage postfix '${title}'": augeas { "manage postfix '${title}'":
incl => "${postfix::confdir}/main.cf", incl => "${postfix::confdir}/main.cf",
lens => 'Postfix_Main.lns', lens => 'Postfix_Main.lns',
......
# @summary Manages the postfix realted files
#
# @api private
#
class postfix::files { class postfix::files {
assert_private() assert_private()
......
# == Definition: postfix::hash # @summary Creates Postfix hashed "map" files, and builds the corresponding db file
# #
# Creates postfix hashed "map" files. It will create "${name}", and then build # Creates postfix hashed "map" files. It will create "${name}", and then build
# "${name}.db" using the "postmap" command. The map file can then be referred to # "${name}.db" using the "postmap" command. The map file can then be referred to
# using postfix::config. # using postfix::config.
# #
# === Parameters # @example Creates a virtual hashmap
# # # This example creates a virtual hashmap in the postfix config dir
# [*name*] - the name of the map file. # # and adds a value into it with the postfix::config type.
# [*ensure*] - present/absent, defaults to present.
# [*source*] - file source. Mutially exclusive with "content".
# [*content*] - content of the file. Mutially exclusive with "source".
#
# === Requires
#
# - Class["postfix"]
#
# === Examples
#
# postfix::hash { 'virtual': # postfix::hash { 'virtual':
# ensure => present, # ensure => present,
# } # }
...@@ -24,6 +14,32 @@ ...@@ -24,6 +14,32 @@
# value => 'hash:/etc/postfix/virtual', # value => 'hash:/etc/postfix/virtual',
# } # }
# #
# @example Create a sasl_passwd hash from a source file
# postfix::hash { '/etc/postfix/sasl_passwd':
# ensure => 'present',
# source => 'puppet:///modules/profile/postfix/client/sasl_passwd',
# }
#
# @example Create a sasl_passwd hash with contents defined in the manifest
# postfix::hash { '/etc/postfix/sasl_passwd':
# ensure => 'present',
# content => '#Destination Credentials\nsmtp.example.com gssapi:nopassword',
# }
#
# @param ensure
# Defines whether the hash map file is present or not. Value can either be present or absent.
# Example: `absent`.
#
# @param source
# A string whose value is a location for the source file to be used. This parameter is mutually
# exclusive with the content parameter, one or the other must be present, but both cannot be present.
# Example: `puppet:///modules/some/location/sasl_passwd`.
#
# @param content
# A free form string that defines the contents of the file. This parameter is mutually exclusive
# with the source parameter.
# Example: `#Destination Credentials\nsmtp.example.com gssapi:nopassword`.
#
define postfix::hash ( define postfix::hash (
Enum['present', 'absent'] $ensure = 'present', Enum['present', 'absent'] $ensure = 'present',
Variant[Array[String], String, Undef] $source = undef, Variant[Array[String], String, Undef] $source = undef,
......
# # @summary The top-level class, to install and configure Postfix
# == Class: postfix
# #
# This class provides a basic setup of postfix with local and remote # This class provides a basic setup of postfix with local and remote
# delivery and an SMTP server listening on the loopback interface. # delivery and an SMTP server listening on the loopback interface.
# #
# === Parameters # @example Default postfix with listen address
# class { 'postfix':
# smtp_listen => '192.168.1.10',
# }
#
# @example Minimal MTA setup
# # This class configures a minimal MTA, delivering mail to
# # $mydestination. Either a valid relay host or the special
# # word 'direct' is required ($relayhost) for outbound email.
# #
# # transport & virtual maps get configured and can be populated with
# # postfix::transport and postfix::virtual
# #
# class { 'postfix':
# relayhost => 'mail.example.com',
# smtp_listen => '0.0.0.0',
# mydestination => '$myorigin, myapp.example.com',
# mta => true,
# }
#
# @example Configure postfix as satellite
# # This configures all local email (cron, mdadm, etc) to be forwarded
# # to $root_mail_recipient, using $relayhost as a relay.
# #
# # This will call postfix::mta and override its parameters.
# # You shouldn't call postfix::mta yourself or use mta=true in the postfix class.
# class { 'postfix':
# relayhost => 'mail.example.com',
# myorigin => 'toto.example.com',
# root_mail_recipient => 'the.sysadmin@example.com',
# satellite => true,
# }
# #
# [*alias_maps*] - (string) # @param alias_maps
# A string defining the location of the alias map file.
# Example: `hash:/etc/other_aliases`
# #
# [*configs*] - (hash) # @param amavis_procs
# Number of amavis scanner processes to spawn
# #
# [*hashes*] - (hash) A hash of postfix::hash resources # @param chroot
# A boolean to define if postfix should be run in a chroot jail or not.
# If not defined, '-' is used (OS dependant)
# Example: `true`
# #
# [*transports*] - (hash) A hash of postfix::transport resources # @param confdir
# The base path which should be used as confdir
# #
# [*virtuals*] - (hash) A hash of postfix::virtual resources # @param conffiles
# A hash of postfix::conffile resources
# #
# [*conffiles*] - (hash) A hash of postfix::conffile resources # @param configs
# A hash of postfix::config resources. The hash containing optional configuration values for main.cf.
# The values are configured using postfix::config.
# Example: `{'message_size_limit': {'value': '51200000'}}`
# #
# [*maps*] - (hash) A hash of postfix::map resources # @param hashes
# A hash of postfix::hash resources
# #
# [*amavis_procs*] - (integer) Number of amavis scanners to spawn # @param inet_interfaces
# A string defining the network interfaces that Postfix will listen on.
# Example: `127.0.0.1, [::1]`
# #
# [*inet_interfaces*] - (string) # @param inet_protocols
# A string defining the internet protocols that Postfix will use.
# Example: `ipv4`
# #
# [*inet_protocols*] - (string) # @param ldap
# A Boolean defining whether to configure Postfix for LDAP use.
# #
# [*ldap*] - (boolean) Whether to use LDAP # @param ldap_base
# A string defining the LDAP search base to use. This parameter maps to the
# search_base parameter (ldap_table(5)).
# Example: `cn=Users,dc=example,dc=com`
# #
# [*ldap_base*] - (string) # @param ldap_host
# A string defining the LDAP host. This parameter maps to the server_host parameter (ldap_table(5)).
# Example: `ldaps://ldap.example.com:636 ldap://ldap2.example.com`.
# #
# [*ldap_host*] - (string) # @param ldap_options
# A free form string that can define any ldap options to be passed through (ldap_table(5)).
# Example: `start_tls = yes`.
# #
# [*ldap_options*] - (string) # @param mail_user
# A string defining the mail user, and optionally group, to execute external commands as.
# This parameter maps to the user parameter (pipe(8)).
# Example: `vmail:vmail`.
# #
# [*mail_user*] - (string) The mail user # @param mailman
# A Boolean defining whether to configure a basic smtp server that is able to work for the
# mailman mailing list manager.
# #
# [*mailman*] - (boolean) # @param mailx_ensure
# Installs mailx package
# #
# [*maincf_source*] - (string) # @param maincf_source
# A string defining the location of a skeleton main.cf file to be used. The default file
# supplied is blank. However, if the main.cf file already exists on the system the contents
# will **NOT** be replaced by the contents from maincf_source.
# Example: `puppet:///modules/some/other/location/main.cf`.
# #
# [*manage_conffiles*] - (boolean) Whether config files are to be replaced # @param manage_aliases
# Manage /etc/aliases file
# #
# [*manage_mailname*] - (boolean) Whether to manage /etc/mailname. # @param manage_conffiles
# A Boolean defining whether the puppet module should replace the configuration files for postfix.
# This setting currently effects only the following files:
# - /etc/mailname
# - /etc/postfix/master.cf
# #
# [*manage_mailx*] - (boolean) Whether to manage mailx package. # This setting does NOT effect the following files:
# - /etc/aliases
# - /etc/postfix/main.cf
# #
# [*masquerade_classes*] - (array) # @param manage_mailname
# A Boolean defining whether the puppet module should manage '/etc/mailname'.
# See also $manage_conffiles
# #
# [*masquerade_domains*] - (array) # @param manage_mailx
# A Boolean defining whether the puppet module should manage the mailx package. See also $mailx_ensure.
# #
# [*masquerade_exceptions*] - (array) # @param manage_root_alias
# Wheter to manage the mailalias for root user
# #
# [*mastercf_source*] - (string) # @param maps
# A hash of postfix::map resources
# #
# [*mastercf_content*] - (string) # @param master_bounce_command
# The bounce command which should be used in master.cf
# #
# [*mastercf_template*] - (string) # @param master_defer_command
# The defer command which should be used in master.cf
# #
# [*master_smtp*] - (string) # @param master_entries
# Array of strings containing additional entries for the /etc/postfix/master.cf file.
# Example: `['submission inet n - n - - smtpd']`.
# #
# [*master_smtps*] - (string) # @param master_smtp
# A string to define the smtp line in the /etc/postfix/master.cf file.
# If this is defined the smtp_listen parameter will be ignored.
# Example: `smtp inet n - n - - smtpd`.
# #
# [*master_submission*] - (string) # @param master_smtps
# A string to define the smtps line in the /etc/postfix/master.cf file.
# Example: `smtps inet n - n - - smtpd`.
# #
# [*master_entries*] - (array of strings) # @param master_submission
# A string to define the submission line in the /etc/postfix/master.cf file.
# Example: `submission inet n - n - - smtpd`.
# #
# [*master_bounce_command*] - (string) # @param mastercf_content
# Set the content parameter for the master.cf file resource.
# #
# [*master_defer_command*] - (string) # @param mastercf_source
# A string defining the location of a skeleton master.cf file to be used.
# Example: `puppet:///modules/some/other/location/master.cf`.
# #
# [*mta*] - (boolean) Configure postfix minimally, as a simple MTA # @param mastercf_template
# Set the epp template path which will be used for master.cf file resource.
# #
# [*mydestination*] - (string) # @param masquerade_classes
# Postfix config parameter masquerade_classes as an array.
# What addresses are subject to address masquerading.
# Example: `['envelope_sender', 'envelope_recipient', 'header_sender', 'header_recipient']`
# #
# [*mynetworks*] - (string)
# #
# [*myorigin*] - (string) # @param masquerade_domains
# An array defining the masquerade_domains to use.
# The order of elements matters here, so be aware of how you define the elements.
# Example: `['foo.example.com', 'example.com']`
# #
# [*manage_aliases*] - (boolean) Manage /etc/aliases file # @param masquerade_exceptions
# An array defining the masquerade_exceptions to use. This optional list of user names that are not
# subjected to address masquerading, even when their addresses match $masquerade_domains.
# Example: `['root']`
# #
# [*relayhost*] - (string) # @param mta
# A Boolean to define whether to configure Postfix as a mail transfer agent.
# This option is mutually exclusive with the satellite Boolean.
# #
# [*root_mail_recipient*] - (string) # @param mydestination
# A string to define the mydestination parameter in main.cf (postconf(5)).
# Example: `example.com, foo.example.com`.
# #
# [*chroot*] - (undef/boolean) Whether postfix should be run in a chroot # @param mynetworks
# A string to define the mynetworks parameter that holds trusted remote smtp clients (postconf(5)).
# Example: `127.0.0.0/8, [::1]/128`.
# #
# [*satellite*] - (boolean) Whether to use as a satellite # @param myorigin
# (implies MTA) # A string to define the myorigin parameter that holds the domain name that mail appears to come from (postconf(5)).
# Example: `example.com`
# #
# [*smtp_listen*] - (string) The SMTP listen interface # @param postfix_ensure
# The ensure value of the postfix package
# #
# [*use_amavisd*] - (boolean) Whether to setup for Amavis # @param relayhost
# A string to define the relayhost parameter (postconf(5)).
# Example: `smtp.example.com`.
# #
# [*use_dovecot_lda*] - (boolean) Whether to setup for Dovecot LDA # @param root_group
# The group permission name for the main.cf and master.cf files.
# #
# [*use_schleuder*] - (2/boolean) Whether to setup for Schleuder # @param root_mail_recipient
# (2 -> Schleuder 2, 3 or true -> Schleuder 3) # A string to define the e-mail address to which all mail directed to root should go (aliases(5)).
# Example: `root_catch@example.com`.
# #
# [*use_sympa*] - (boolean) Whether to setup for Sympa # @param satellite
# A Boolean to define whether to configure postfix as a satellite relay host.
# This setting is mutually exclusive with the mta Boolean.
# #
# [*postfix_ensure*] - (string) The ensure value of the postfix package # @param service_enabled
# Defines if the service 'postfix' is enabled on the system
# #
# [*mailx_ensure*] - (string) The ensure value of the mailx package # @param service_ensure
# Defines the service state of 'postfix' service
# #
# === Examples # @param smtp_listen
# A string or an array of strings to define the IPs on which to listen in master.cf.
# This can also be set to 'all' to listen on all interfaces. If master_smtp is defined
# smtp_listen will not be used.
# Example: `::1`.
# #
# class { 'postfix': # @param transports
# smtp_listen => '192.168.1.10', # A hash of postfix::transport resources
# } #
# @param use_amavisd
# A Boolean to define whether to configure master.cf to allow the use of the amavisd scanner.
#
# @param use_dovecot_lda
# A Boolean to define whether to configure master.cf to use dovecot as the local delivery agent.
#
# @param use_schleuder
# A Boolean to define whether to configure master.cf to use the Schleuder GPG-enabled mailing list.
# Can be also set to an integer `2` to use Schleuder v2 instead of v3.
#
# @param use_sympa
# A Boolean to define whether to configure master.cf to use the Sympa mailing list management software.
#
# @param virtuals
# A hash of postfix::virtual resources
# #
class postfix ( class postfix (
Stdlib::Absolutepath $confdir = '/etc/postfix',
String $root_group = 'root',
String $alias_maps = 'hash:/etc/aliases', String $alias_maps = 'hash:/etc/aliases',
Integer $amavis_procs = 2,
Optional[Boolean] $chroot = undef,
Stdlib::Absolutepath $confdir = '/etc/postfix',
Hash $conffiles = {},
Hash $configs = {}, Hash $configs = {},
Hash $hashes = {}, Hash $hashes = {},
Hash $transports = {},
Hash $virtuals = {},
Hash $conffiles = {},
Hash $maps = {},
Integer $amavis_procs = 2,
String $inet_interfaces = 'all', String $inet_interfaces = 'all',
String $inet_protocols = 'all', String $inet_protocols = 'all',
Boolean $ldap = false, Boolean $ldap = false,
...@@ -129,41 +260,44 @@ class postfix ( ...@@ -129,41 +260,44 @@ class postfix (
Optional[String] $ldap_options = undef, Optional[String] $ldap_options = undef,
String $mail_user = 'vmail', # postfix_mail_user String $mail_user = 'vmail', # postfix_mail_user
Boolean $mailman = false, Boolean $mailman = false,
String $mailx_ensure = 'present',
String $maincf_source = "puppet:///modules/${module_name}/main.cf", String $maincf_source = "puppet:///modules/${module_name}/main.cf",
Boolean $manage_aliases = true, # /etc/aliases
Boolean $manage_conffiles = true, Boolean $manage_conffiles = true,
Boolean $manage_mailname = true, Boolean $manage_mailname = true,
Boolean $manage_mailx = true, Boolean $manage_mailx = true,
Optional[Array[String[1]]] $masquerade_classes = undef, Boolean $manage_root_alias = true,
Optional[Array[String[1]]] $masquerade_domains = undef, Hash $maps = {},
Optional[Array[String[1]]] $masquerade_exceptions = undef, String $master_bounce_command = 'bounce',
Optional[String] $mastercf_source = undef, String $master_defer_command = 'bounce',
Optional[String] $mastercf_content = undef, Array[String] $master_entries = [], # postfix_master_entries
Optional[String] $mastercf_template = undef,
Optional[String] $master_smtp = undef, # postfix_master_smtp Optional[String] $master_smtp = undef, # postfix_master_smtp
Optional[String] $master_smtps = undef, # postfix_master_smtps Optional[String] $master_smtps = undef, # postfix_master_smtps
Optional[String] $master_submission = undef, # postfix_master_submission Optional[String] $master_submission = undef, # postfix_master_submission
Array[String] $master_entries = [], # postfix_master_entries Optional[String] $mastercf_content = undef,
String $master_bounce_command = 'bounce', Optional[String] $mastercf_source = undef,
String $master_defer_command = 'bounce', Optional[String] $mastercf_template = undef,
Optional[Array[String[1]]] $masquerade_classes = undef,
Optional[Array[String[1]]] $masquerade_domains = undef,
Optional[Array[String[1]]] $masquerade_exceptions = undef,
Boolean $mta = false, Boolean $mta = false,
String $mydestination = '$myorigin', # postfix_mydestination String $mydestination = '$myorigin', # postfix_mydestination
String $mynetworks = '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128', # postfix_mynetworks String $mynetworks = '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128', # postfix_mynetworks
String $myorigin = $facts['networking']['fqdn'], String $myorigin = $facts['networking']['fqdn'],
Boolean $manage_aliases = true, # /etc/aliases String $postfix_ensure = 'present',
Optional[String] $relayhost = undef, # postfix_relayhost Optional[String] $relayhost = undef, # postfix_relayhost
Boolean $manage_root_alias = true, String $root_group = 'root',
Variant[Array[String], String] $root_mail_recipient = 'nobody', # root_mail_recipient Variant[Array[String], String] $root_mail_recipient = 'nobody', # root_mail_recipient
Optional[Boolean] $chroot = undef,
Boolean $satellite = false, Boolean $satellite = false,
Boolean $service_enabled = true,
String $service_ensure = 'running',
Variant[Array[String[1]], String[1]] $smtp_listen = '127.0.0.1', # postfix_smtp_listen Variant[Array[String[1]], String[1]] $smtp_listen = '127.0.0.1', # postfix_smtp_listen
Hash $transports = {},
Boolean $use_amavisd = false, # postfix_use_amavisd Boolean $use_amavisd = false, # postfix_use_amavisd
Boolean $use_dovecot_lda = false, # postfix_use_dovecot_lda Boolean $use_dovecot_lda = false, # postfix_use_dovecot_lda
Variant[Integer[2, 3], Boolean] $use_schleuder = false, # postfix_use_schleuder Variant[Integer[2, 3], Boolean] $use_schleuder = false, # postfix_use_schleuder
Boolean $use_sympa = false, # postfix_use_sympa Boolean $use_sympa = false, # postfix_use_sympa
String $postfix_ensure = 'present', Hash $virtuals = {},
String $mailx_ensure = 'present',
String $service_ensure = 'running',
Boolean $service_enabled = true,
) inherits postfix::params { ) inherits postfix::params {
if ( if (
($mastercf_source and $mastercf_content) or ($mastercf_source and $mastercf_content) or
......
# == Class: postfix::ldap # @summary Provides the postfix ldap support
# #
# Configures postfix for use with LDAP. # @api private
#
# === Parameters
#
# === Requires
#
# - Class["postfix"]
#
# === Examples
#
# include postfix
# include postfix::ldap
# #
class postfix::ldap { class postfix::ldap {
assert_private()
assert_type(String, $postfix::ldap_base) assert_type(String, $postfix::ldap_base)
assert_type(String, $postfix::ldap_host) assert_type(String, $postfix::ldap_host)
assert_type(String, $postfix::ldap_options) assert_type(String, $postfix::ldap_options)
......
# == Definition: postfix::mailalias # @summary Manage the content of the postfix alias map
# #
# Creates an email alias in the local alias database and updates the binary # Creates an email alias in the local alias database and updates the binary
# version of said database. # version of said database.
# #
# === Parameters # @example Simple example
#
# [*name*] - the alias name. See aliases(5).
# [*ensure*] - present/absent, defaults to present.
# [*recipient*] - where email should be sent.
#
# === Requires
#
# - Class["postfix"]
#
# === Examples
#
# node "toto.example.com" {
#
# include postfix # include postfix
#
# postfix::mailalias { 'postmaster': # postfix::mailalias { 'postmaster':
# ensure => present, # ensure => present,
# recipient => 'foo', # recipient => 'foo',
# } # }
# #
# @param ensure
# Intended state of the resource
#
# @param recipient
# The recipient address where the mail should be sent to.
#
# @see http://www.postfix.org/aliases.5.html
#
define postfix::mailalias ( define postfix::mailalias (
Variant[String, Array[String]] $recipient, Variant[String, Array[String]] $recipient,
Enum['present', 'absent'] $ensure='present', Enum['present', 'absent'] $ensure = 'present'
) { ) {
mailalias { $title: mailalias { $title:
ensure => $ensure, ensure => $ensure,
......
# == Class: postfix::mailman # @summary Configure postfix to work with mailman
# #
# Configures a basic smtp server, able to work for the mailman mailing-list # Configures a basic smtp server, able to work for the mailman mailing-list
# manager. # manager.
# #
# === Examples # @api private
# #
# /!\ Do not include this class directly,
# use mailman => true in the postfix top class!
#
# class { 'postfix':
# mailman => true,
# }
class postfix::mailman { class postfix::mailman {
assert_private()
include postfix include postfix
postfix::config { postfix::config {
......
# == Definition: postfix::map # @summary Create a postfix map file
# #
# Creates postfix "map" files. It will create "${name}", and then build # Creates postfix "map" files. It will create "${name}", and then build
# "${name}.db" using the "postmap" command. The map file can then be referred to # "${name}.db" using the "postmap" command. The map file can then be referred to
# using postfix::config. # using postfix::config.
# #
# === Parameters # @example Postfix map file and use in config
#
# [*name*] - the name of the map file.
# [*ensure*] - present/absent, defaults to present.
# [*source*] - file source.
# [*type*] - type of the postfix map (valid values are cidr, pcre, hash...)
# [*path*] - path of the created file. By default it is placed in the
# postfix directory.
# [*mode*] - mode of the created file. By default it is '0640'.
#
# === Requires
#
# - Class["postfix"]
#
# === Examples
#
# postfix::map { '/etc/postfix/virtual': # postfix::map { '/etc/postfix/virtual':
# ensure => present, # ensure => present,
# } # }
...@@ -27,6 +12,28 @@ ...@@ -27,6 +12,28 @@
# value => 'hash:/etc/postfix/virtual', # value => 'hash:/etc/postfix/virtual',
# } # }
# #
# @param ensure
# Intended state of the resource
#
# @param source
# Sets the value of the source parameter for the file. Can't be used
# together with parameter content.
#
# @param content
# The content of the file. Can't be used together with param source.
#
# @param type
# Type of the postfix map (valid values are cidr, pcre, hash...)
#
# @param path
# Where to create the file. If not defined "${postfix::confdir}/${name}"
# will be used as path.
#
# @param mode
# File mode of the created file.
#
# @see http://www.postfix.org/postmap.1.html
#
define postfix::map ( define postfix::map (
Enum['present', 'absent'] $ensure = 'present', Enum['present', 'absent'] $ensure = 'present',
Optional[Variant[Array[String], String]] $source = undef, Optional[Variant[Array[String], String]] $source = undef,
......
# == Class: postfix::mta # @summary Configures postfix as minimal MTA
# #
# This class configures a minimal MTA, delivering mail to # @api private
# $mydestination.
#
# Either a valid relay host or the special word 'direct' is required
# ($relayhost) for outbound email.
#
# transport & virtual maps get configured and can be populated with
# postfix::transport and postfix::virtual
#
# === Parameters
#
# [*relayhost*] - (string) the relayhost to use or 'direct' to send mail
# directly without a relay.
# [*mydestination*] - (string)
# [*mynetworks*] - (string)
# [*masquerade_classes*] - (array)
# [*masquerade_domains*] - (array)
# [*masquerade_exceptions*] - (array)
#
# === Examples
#
# class { 'postfix':
# relayhost => 'mail.example.com',
# smtp_listen => '0.0.0.0',
# mydestination => '$myorigin, myapp.example.com',
# mta => true,
# }
# #
class postfix::mta ( class postfix::mta (
Optional[Pattern[/^\S+(?:,\s*\S+)*$/]] $mydestination = undef, Optional[Pattern[/^\S+(?:,\s*\S+)*$/]] $mydestination = undef,
...@@ -36,6 +10,7 @@ class postfix::mta ( ...@@ -36,6 +10,7 @@ class postfix::mta (
Optional[Array[String[1]]] $masquerade_domains = undef, Optional[Array[String[1]]] $masquerade_domains = undef,
Optional[Array[String[1]]] $masquerade_exceptions = undef, Optional[Array[String[1]]] $masquerade_exceptions = undef,
) { ) {
assert_private()
include postfix include postfix
$_mydestination = pick($mydestination, $postfix::mydestination) $_mydestination = pick($mydestination, $postfix::mydestination)
......
# @summary Install the required packages for postfix
#
# @api private
#
class postfix::packages { class postfix::packages {
assert_private() assert_private()
......
# # @summary Default parameters
# == Class: postfix::params
# #
# This class provides the appropriate values for operating system specific variables. # This class provides the appropriate values for operating system specific variables.
# #
# === Parameters # @param mailx_package
# Name of package that provides mailx
# #
# [*mailx_package*] - (string) Name of package that provides mailx # @param restart_cmd
# Command to use when restarting postfix
# #
# [*restart_cmd*] - (hash) Command to use when restarting postfix # @param aliasesseltype
# Selinux type for /etc/aliases
# #
# [*aliasesseltype*] - (string) Selinux type for /etc/aliases # @param seltype
# Selinux type for /etc/postfix/* config files
# #
# [*seltype*] - (string) Selinux type for /etc/postfix/* config files # @param master_os_template
# Path to the master template
# #
# [*master_os_template*] - (string) Path to the master template # @api private
# #
class postfix::params ( class postfix::params (
String $mailx_package, String $mailx_package,
......
# @summary Configure postfix as satellite
# #
# == Class: postfix::satellite # @api private
#
# This class configures all local email (cron, mdadm, etc) to be forwarded
# to $root_mail_recipient, using $relayhost as a relay.
#
# This class will call postfix::mta and override its parameters.
# You shouldn't call postfix::mta yourself or use mta=true in the postfix class.
#
# === Parameters
#
# [*mydestination*] - (string)
# [*mynetworks*] - (string)
# [*relayhost*] - (string)
# [*masquerade_classes*] - (array)
# [*masquerade_domains*] - (array)
# [*masquerade_exceptions*] - (array)
#
# === Examples
#
# class { 'postfix':
# relayhost => 'mail.example.com',
# myorigin => 'toto.example.com',
# root_mail_recipient => 'the.sysadmin@example.com',
# satellite => true,
# }
# #
class postfix::satellite ( class postfix::satellite (
$mydestination = undef, $mydestination = undef,
...@@ -33,6 +10,7 @@ class postfix::satellite ( ...@@ -33,6 +10,7 @@ class postfix::satellite (
$masquerade_domains = undef, $masquerade_domains = undef,
$masquerade_exceptions = undef, $masquerade_exceptions = undef,
) { ) {
assert_private()
include postfix include postfix
assert_type(Pattern[/^\S+$/], $postfix::myorigin) assert_type(Pattern[/^\S+$/], $postfix::myorigin)
......
# @summary Manage service resources for postfix
#
# @api private
#
class postfix::service { class postfix::service {
assert_private() assert_private()
......
# == Definition: postfix::transport # @summary Manage the transport map of postfix
# #
# Manages content of the /etc/postfix/transport map. # Manages content of the /etc/postfix/transport map.
# #
# === Parameters # @example Simple transport map config
#
# [*name*] - name of address postfix will lookup. See transport(5).
# [*destination*] - where the emails will be delivered to. See transport(5).
# [*ensure*] - present/absent, defaults to present.
# [*nexthop*] - A string to define where and how to deliver the mail. See transport(5).
#
# === Requires
#
# - Class["postfix"]
# - Postfix::Hash["/etc/postfix/transport"]
# - Postfix::Config["transport_maps"]
# - augeas
#
# === Examples
#
# node 'toto.example.com' {
#
# include postfix # include postfix
#
# postfix::hash { '/etc/postfix/transport': # postfix::hash { '/etc/postfix/transport':
# ensure => present, # ensure => present,
# } # }
...@@ -39,13 +21,28 @@ ...@@ -39,13 +21,28 @@
# destination => 'slow' # destination => 'slow'
# } # }
# #
# } # @param ensure
# Defines whether the transport entry is present or not. Value can either be present or absent.
#
# @param destination
# The destination to be delivered to (transport(5)).
# Example: `mailman`.
#
# @param nexthop
# A string to define where and how to deliver the mail (transport(5)).
# Example: `[smtp.google.com]:25`.
#
# @param file
# Where to create the file. If not defined "${postfix::confdir}/transport"
# will be used as path.
#
# @see https://www.postfix.org/transport.5.html
# #
define postfix::transport ( define postfix::transport (
Enum['present', 'absent'] $ensure = 'present',
Optional[String] $destination = undef, Optional[String] $destination = undef,
Optional[String] $nexthop = undef, Optional[String] $nexthop = undef,
Optional[Stdlib::Absolutepath] $file = undef, Optional[Stdlib::Absolutepath] $file = undef,
Enum['present', 'absent'] $ensure='present'
) { ) {
include postfix include postfix
include postfix::augeas include postfix::augeas
......
# == Definition: postfix::virtual # @summary Manages the contents of the virtual map.
# #
# Manages content of the /etc/postfix/virtual map. # Manages content of the /etc/postfix/virtual map.
# #
# === Parameters # @example Minimum Requirements
#
# [*name*] - name of address postfix will lookup. See virtual(8).
# [*destination*] - a list of destinations where the emails will be delivered to. See virtual(8).
# [*ensure*] - present/absent, defaults to present.
# [*file*] - a string defining the location of the pre-hash map.
#
# === Requires
#
# - Class["postfix"]
# - Postfix::Hash["/etc/postfix/virtual"]
# - Postfix::Config["virtual_alias_maps"]
# - augeas
#
# === Examples
#
# node "toto.example.com" {
#
# include postfix # include postfix
# # postfix::hash { "/etc/postfix/virtual": # postfix::hash { "/etc/postfix/virtual":
# ensure => present, # ensure => present,
# } # }
# postfix::config { "virtual_alias_maps": # postfix::config { "virtual_alias_maps":
# value => "hash:/etc/postfix/virtual, regexp:/etc/postfix/virtual_regexp" # value => "hash:/etc/postfix/virtual, regexp:/etc/postfix/virtual_regexp"
# } # }
#
# @example Route mail to local users
# postfix::virtual { "user@example.com": # postfix::virtual { "user@example.com":
# ensure => present, # ensure => present,
# destination => ['root', 'postmaster'], # destination => ['root', 'postmaster'],
# } # }
#
# @example Regex example
# postfix::virtual { "/.+@.+/" # postfix::virtual { "/.+@.+/"
# ensure => present, # ensure => present,
# file => '/etc/postfix/virtual_regexp', # file => '/etc/postfix/virtual_regexp',
# destination => 'root', # destination => 'root',
# } # }
#
# @example Route mail bound for 'user@example.com' to root.
# postfix::virtual {'user@example.com':
# ensure => present,
# destination => 'root',
# } # }
#
# @param ensure
# A string whose valid values are present or absent.
#
# @param destination
# A string defining where the e-mails will be delivered to, (virtual(8)).
# Example: `root`
#
# @param file
# A string defining the location of the virtual map, pre hash.
# If not defined "${postfix::confdir}/virtual" will be used as path.
# Example: `/etc/postfix/my_virtual_map`.
#
# @see https://www.postfix.org/virtual.8.html
#
define postfix::virtual ( define postfix::virtual (
Variant[String, Array[String]] $destination, Variant[String, Array[String]] $destination,
Optional[Stdlib::Absolutepath] $file=undef, Enum['present', 'absent'] $ensure = 'present',
Enum['present', 'absent'] $ensure='present' Optional[Stdlib::Absolutepath] $file = undef
) { ) {
include postfix include postfix
include postfix::augeas include postfix::augeas
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment