diff --git a/README.md b/README.md index 7407466..5da6394 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,21 @@ postfix::lookup::ldap { '/etc/postfix/virtualrecipients.cf': } ``` +## Service management + +By default this module restarts the postfix service on config changes. + +To prevent clients being disconnected during mail delivery, +this behaviour can be changed using the parameter `service_restart_command` of class `postfix::init`. + +Note, some changes need a restart to get effect: +[http://www.postfix.org/postconf.5.html](http://www.postfix.org/postconf.5.html) + +Example in Hiera for reloading postfix on changes: +``` +postfix::service_restart_command: '/usr/bin/systemctl reload postfix.service' +``` + ## Reference The reference documentation is generated with diff --git a/REFERENCE.md b/REFERENCE.md index 6db34b1..0c506b3 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -136,6 +136,7 @@ The following parameters are available in the `postfix` class: * [`lookup_packages`](#lookup_packages) * [`package_name`](#package_name) * [`service_name`](#service_name) +* [`service_restart_command`](#service_restart_command) * [`twobounce_notice_recipient`](#twobounce_notice_recipient) * [`access_map_defer_code`](#access_map_defer_code) * [`access_map_reject_code`](#access_map_reject_code) @@ -878,6 +879,12 @@ Data type: `String` +##### `service_restart_command` + +Data type: `String` + + + ##### `twobounce_notice_recipient` Data type: `Optional[String]` diff --git a/data/common.yaml b/data/common.yaml index f1d490d..ce18c8d 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -3,6 +3,7 @@ postfix::conf_dir: '/etc/postfix' postfix::lookup_packages: {} postfix::package_name: 'postfix' postfix::service_name: 'postfix' +postfix::service_restart_command: ~ postfix::services: {} postfix::twobounce_notice_recipient: ~ postfix::access_map_defer_code: ~ diff --git a/manifests/init.pp b/manifests/init.pp index 4620e85..6eb3407 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -52,6 +52,7 @@ # @param lookup_packages # @param package_name # @param service_name +# @param service_restart_command # @param twobounce_notice_recipient `2bounce_notice_recipient` is a violation # of Puppet variable naming conventions. # @param access_map_defer_code @@ -781,6 +782,7 @@ Hash[Postfix::Type::Lookup, String] $lookup_packages, String $package_name, String $service_name, + Optional[String] $service_restart_command, # main.cf parameters below Optional[String] $twobounce_notice_recipient, Optional[String] $access_map_defer_code, diff --git a/manifests/service.pp b/manifests/service.pp index 0153e2f..f4f8e1a 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -6,5 +6,6 @@ enable => true, hasstatus => true, hasrestart => true, + restart => $postfix::service_restart_command, } }