postfix: added/reformated documentation
This commit is contained in:
parent
e597522fbf
commit
1c249d42e9
9 changed files with 207 additions and 31 deletions
12
README
12
README
|
@ -1,4 +1,12 @@
|
||||||
include postfix
|
= Postfix Puppet module
|
||||||
|
|
||||||
postfix::config { "relay_domains": value => "localhost host.foo.com" }
|
This module will help install and configure postfix.
|
||||||
|
|
||||||
|
A couple of classes will preconfigure postfix for common needs.
|
||||||
|
|
||||||
|
== Example:
|
||||||
|
|
||||||
|
include postfix
|
||||||
|
|
||||||
|
postfix::config { "relay_domains": value => "localhost host.foo.com" }
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
#
|
||||||
|
# == Class: postfix::mailman
|
||||||
|
#
|
||||||
|
# Configures a basic smtp server, able to work for the mailman mailing-list
|
||||||
|
# manager.
|
||||||
|
#
|
||||||
|
# Parameters:
|
||||||
|
# - every global variable which works for class "postfix" will work here.
|
||||||
|
#
|
||||||
|
# Example usage:
|
||||||
|
#
|
||||||
|
# node "toto.example.com" {
|
||||||
|
# include mailman
|
||||||
|
# include postfix::mailman
|
||||||
|
# }
|
||||||
|
#
|
||||||
class postfix::mailman {
|
class postfix::mailman {
|
||||||
$postfix_ng_smtp_listen = "0.0.0.0"
|
$postfix_ng_smtp_listen = "0.0.0.0"
|
||||||
include postfix
|
include postfix
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#########################################################################
|
#
|
||||||
|
# == Class: postfix::mta
|
||||||
#
|
#
|
||||||
# This class configures a minimal MTA, listening on
|
# This class configures a minimal MTA, listening on
|
||||||
# $postfix_ng_smtp_listen (default to localhost) and delivering mail to
|
# $postfix_ng_smtp_listen (default to localhost) and delivering mail to
|
||||||
|
@ -9,22 +10,26 @@
|
||||||
# transport & virtual maps get configured and can be populated with
|
# transport & virtual maps get configured and can be populated with
|
||||||
# postfix::transport and postfix::virtual
|
# postfix::transport and postfix::virtual
|
||||||
#
|
#
|
||||||
# Example:
|
# Parameters:
|
||||||
|
# - *$postfix_relayhost*
|
||||||
|
# - *$postfix_mydestination*
|
||||||
|
# - every global variable which works for class "postfix" will work here.
|
||||||
#
|
#
|
||||||
# node "toto.example.com" {
|
# Example usage:
|
||||||
# $postfix_relayhost = "mail.example.com"
|
|
||||||
# $postfix_ng_smtp_listen = "0.0.0.0"
|
|
||||||
# $postfix_mydestination = "\$myorigin, myapp.example.com"
|
|
||||||
#
|
#
|
||||||
# include postfix::mta
|
# node "toto.example.com" {
|
||||||
|
# $postfix_relayhost = "mail.example.com"
|
||||||
|
# $postfix_ng_smtp_listen = "0.0.0.0"
|
||||||
|
# $postfix_mydestination = "\$myorigin, myapp.example.com"
|
||||||
#
|
#
|
||||||
# postfix::transport { "myapp.example.com":
|
# include postfix::mta
|
||||||
# ensure => present,
|
#
|
||||||
# destination => "local:",
|
# postfix::transport { "myapp.example.com":
|
||||||
|
# ensure => present,
|
||||||
|
# destination => "local:",
|
||||||
|
# }
|
||||||
# }
|
# }
|
||||||
# }
|
|
||||||
#
|
#
|
||||||
|
|
||||||
class postfix::mta {
|
class postfix::mta {
|
||||||
|
|
||||||
case $postfix_relayhost {
|
case $postfix_relayhost {
|
||||||
|
|
|
@ -1,26 +1,29 @@
|
||||||
#########################################################################
|
#
|
||||||
|
# == Class: postfix::satellite
|
||||||
#
|
#
|
||||||
# This class configures all local email (cron, mdadm, etc) to be forwarded
|
# This class configures all local email (cron, mdadm, etc) to be forwarded
|
||||||
# to $root_mail_recipient, using $postfix_relayhost as a relay.
|
# to $root_mail_recipient, using $postfix_relayhost as a relay.
|
||||||
#
|
#
|
||||||
# $valid_fqdn can be set to override $fqdn in the case where the FQDN is
|
# $valid_fqdn can be set to override $fqdn in the case where the FQDN is
|
||||||
# not recognized as valid by the destination server.
|
# not recognized as valid by the destination server.
|
||||||
#
|
#
|
||||||
# All other parameters for postfix::mta are valid.
|
# Parameters:
|
||||||
|
# - *valid_fqdn*
|
||||||
|
# - every global variable which works for class "postfix" will work here.
|
||||||
#
|
#
|
||||||
# Example:
|
# Example usage:
|
||||||
#
|
#
|
||||||
# node "toto.local.lan" {
|
# node "toto.local.lan" {
|
||||||
# $postfix_relayhost = "mail.example.com"
|
# $postfix_relayhost = "mail.example.com"
|
||||||
# $valid_fqdn = "toto.example.com"
|
# $valid_fqdn = "toto.example.com"
|
||||||
# $root_mail_recipient = "the.sysadmin@example.com"
|
# $root_mail_recipient = "the.sysadmin@example.com"
|
||||||
|
#
|
||||||
|
# include postfix::satellite
|
||||||
|
# }
|
||||||
#
|
#
|
||||||
# include postfix::satellite
|
|
||||||
# }
|
|
||||||
|
|
||||||
class postfix::satellite {
|
class postfix::satellite {
|
||||||
|
|
||||||
# If $fake_fqdn exists, use it to override $fqdn
|
# If $valid_fqdn exists, use it to override $fqdn
|
||||||
case $valid_fqdn {
|
case $valid_fqdn {
|
||||||
"": { $valid_fqdn = $fqdn }
|
"": { $valid_fqdn = $fqdn }
|
||||||
default: { $fqdn = "${valid_fqdn}" }
|
default: { $fqdn = "${valid_fqdn}" }
|
||||||
|
|
|
@ -1,11 +1,23 @@
|
||||||
#########################################################################
|
#
|
||||||
|
# == 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:
|
||||||
|
# - *$postfix_ng_smtp_listen*: address on which the smtp service will listen to. defaults to 127.0.0.1
|
||||||
|
# - *$root_mail_recipient*: who will recieve root's emails. defaults to "nobody"
|
||||||
|
#
|
||||||
|
# Example usage:
|
||||||
|
#
|
||||||
|
# node "toto.example.com" {
|
||||||
|
# $postfix_ng_smtp_listen = "192.168.1.10"
|
||||||
|
# include postfix
|
||||||
|
# }
|
||||||
|
#
|
||||||
class postfix {
|
class postfix {
|
||||||
|
|
||||||
|
# selinux labels differ from one distribution to another
|
||||||
case $operatingsystem {
|
case $operatingsystem {
|
||||||
|
|
||||||
RedHat: {
|
RedHat: {
|
||||||
|
@ -46,7 +58,6 @@ class postfix {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Aliases
|
# Aliases
|
||||||
|
|
||||||
file { "/etc/aliases":
|
file { "/etc/aliases":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
content => "# file managed by puppet\n",
|
content => "# file managed by puppet\n",
|
||||||
|
@ -55,6 +66,7 @@ class postfix {
|
||||||
notify => Exec["newaliases"],
|
notify => Exec["newaliases"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Aliases
|
||||||
exec { "newaliases":
|
exec { "newaliases":
|
||||||
command => "/usr/bin/newaliases",
|
command => "/usr/bin/newaliases",
|
||||||
refreshonly => true,
|
refreshonly => true,
|
||||||
|
@ -63,7 +75,6 @@ class postfix {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Config files
|
# Config files
|
||||||
|
|
||||||
file { "/etc/postfix/master.cf":
|
file { "/etc/postfix/master.cf":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
owner => "root",
|
owner => "root",
|
||||||
|
@ -77,6 +88,7 @@ class postfix {
|
||||||
require => Package["postfix"],
|
require => Package["postfix"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Config files
|
||||||
file { "/etc/postfix/main.cf":
|
file { "/etc/postfix/main.cf":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
owner => "root",
|
owner => "root",
|
||||||
|
@ -89,7 +101,6 @@ class postfix {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Default configuration parameters
|
# Default configuration parameters
|
||||||
|
|
||||||
postfix::config {
|
postfix::config {
|
||||||
"myorigin": value => "${fqdn}";
|
"myorigin": value => "${fqdn}";
|
||||||
"alias_maps": value => "hash:/etc/aliases";
|
"alias_maps": value => "hash:/etc/aliases";
|
||||||
|
|
|
@ -1,3 +1,34 @@
|
||||||
|
/*
|
||||||
|
== Definition: postfix::config
|
||||||
|
|
||||||
|
Uses the "postconf" command to add/alter/remove options in postfix main
|
||||||
|
configuation file (/etc/postfix/main.cf).
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
- *name*: name of the parameter.
|
||||||
|
- *ensure*: present/absent. defaults to present.
|
||||||
|
- *value*: value of the parameter.
|
||||||
|
- *nonstandard*: inform postfix::config that this parameter is not recognized
|
||||||
|
by the "postconf" command. defaults to false.
|
||||||
|
|
||||||
|
Requires:
|
||||||
|
- Class["postfix"]
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
|
||||||
|
node "toto.example.com" {
|
||||||
|
|
||||||
|
include postfix
|
||||||
|
|
||||||
|
postfix::config {
|
||||||
|
"smtp_use_tls" => "yes";
|
||||||
|
"smtp_sasl_auth_enable" => "yes";
|
||||||
|
"smtp_sasl_password_maps" => "hash:/etc/postfix/my_sasl_passwords";
|
||||||
|
"relayhost" => "[mail.example.com]:587";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
define postfix::config ($ensure = present, $value, $nonstandard = false) {
|
define postfix::config ($ensure = present, $value, $nonstandard = false) {
|
||||||
case $ensure {
|
case $ensure {
|
||||||
present: {
|
present: {
|
||||||
|
|
|
@ -1,5 +1,37 @@
|
||||||
|
/*
|
||||||
|
== Definition: postfix::hash
|
||||||
|
|
||||||
|
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
|
||||||
|
using postfix::config.
|
||||||
|
|
||||||
|
Note: the content of the file is not managed by this definition.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
- *name*: the name of the map file.
|
||||||
|
- *ensure*: present/absent
|
||||||
|
|
||||||
|
Requires:
|
||||||
|
- Class["postfix"]
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
|
||||||
|
node "toto.example.com" {
|
||||||
|
|
||||||
|
include postfix
|
||||||
|
|
||||||
|
postfix::hash { "/etc/postfix/virtual":
|
||||||
|
ensure => present,
|
||||||
|
}
|
||||||
|
postfix::config { "virtual_alias_maps":
|
||||||
|
value => "hash:/etc/postfix/virtual"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
define postfix::hash ($ensure) {
|
define postfix::hash ($ensure) {
|
||||||
|
|
||||||
|
# selinux labels differ from one distribution to another
|
||||||
case $operatingsystem {
|
case $operatingsystem {
|
||||||
|
|
||||||
RedHat: {
|
RedHat: {
|
||||||
|
|
|
@ -1,3 +1,38 @@
|
||||||
|
/*
|
||||||
|
== Definition: postfix::transport
|
||||||
|
|
||||||
|
Manages content of the /etc/postfix/transport map.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
- *name*: name of address postfix will lookup. See transport(5).
|
||||||
|
- *destination*: where the emails will be delivered to. See transport(5).
|
||||||
|
- *ensure*: present/absent
|
||||||
|
|
||||||
|
Requires:
|
||||||
|
- Class["postfix"]
|
||||||
|
- Postfix::Hash["/etc/postfix/transport"]
|
||||||
|
- Postfix::Config["transport_maps"]
|
||||||
|
- common::line (from module common)
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
|
||||||
|
node "toto.example.com" {
|
||||||
|
|
||||||
|
include postfix
|
||||||
|
|
||||||
|
postfix::hash { "/etc/postfix/transport":
|
||||||
|
ensure => present,
|
||||||
|
}
|
||||||
|
postfix::config { "transport_maps":
|
||||||
|
value => "hash:/etc/postfix/transport"
|
||||||
|
}
|
||||||
|
postfix::transport { "mailman.example.com":
|
||||||
|
ensure => present,
|
||||||
|
destination => "mailman",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
define postfix::transport ($ensure, $destination) {
|
define postfix::transport ($ensure, $destination) {
|
||||||
line {"${name} ${destination}":
|
line {"${name} ${destination}":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
|
|
|
@ -1,3 +1,38 @@
|
||||||
|
/*
|
||||||
|
== Definition: postfix::virtual
|
||||||
|
|
||||||
|
Manages content of the /etc/postfix/virtual map.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
- *name*: name of address postfix will lookup. See virtual(8).
|
||||||
|
- *destination*: where the emails will be delivered to. See virtual(8).
|
||||||
|
- *ensure*: present/absent
|
||||||
|
|
||||||
|
Requires:
|
||||||
|
- Class["postfix"]
|
||||||
|
- Postfix::Hash["/etc/postfix/virtual"]
|
||||||
|
- Postfix::Config["virtual_alias_maps"]
|
||||||
|
- common::line (from module common)
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
|
||||||
|
node "toto.example.com" {
|
||||||
|
|
||||||
|
include postfix
|
||||||
|
|
||||||
|
postfix::hash { "/etc/postfix/virtual":
|
||||||
|
ensure => present,
|
||||||
|
}
|
||||||
|
postfix::config { "virtual_alias_maps":
|
||||||
|
value => "hash:/etc/postfix/virtual"
|
||||||
|
}
|
||||||
|
postfix::virtual { "user@example.com":
|
||||||
|
ensure => present,
|
||||||
|
destination => "root",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
define postfix::virtual ($ensure, $destination) {
|
define postfix::virtual ($ensure, $destination) {
|
||||||
line {"${name} ${destination}":
|
line {"${name} ${destination}":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
|
|
Loading…
Reference in a new issue