diff --git a/REFERENCE.md b/REFERENCE.md
index 52767c43..28780d05 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -102,6 +102,7 @@ The following parameters are available in the `postfix` class:
* [`ldap_options`](#-postfix--ldap_options)
* [`ldap_packages`](#-postfix--ldap_packages)
* [`lookup_table_type`](#-postfix--lookup_table_type)
+* [`mailaliases`](#-postfix--mailaliases)
* [`mail_user`](#-postfix--mail_user)
* [`mailman`](#-postfix--mailman)
* [`mailx_ensure`](#-postfix--mailx_ensure)
@@ -275,6 +276,16 @@ Type has to be supported by system, see "postconf -m" for supported types.
Default value: `'hash'`
+##### `mailaliases`
+
+Data type: `Hash`
+
+A hash of postfix::mailalias resources. The hash containing optional configuration values for main.cf.
+The values are configured using postfix::mailalias.
+Example: `{'nobody': {'ensure': 'present', 'recipient': 'root'}}`
+
+Default value: `{}`
+
##### `mail_user`
Data type: `String`
diff --git a/manifests/init.pp b/manifests/init.pp
index e46057ed..64e0159e 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -93,6 +93,11 @@
# Table format type as described in http://www.postfix.org/DATABASE_README.html#types.
# Type has to be supported by system, see "postconf -m" for supported types.
#
+# @param mailaliases
+# A hash of postfix::mailalias resources. The hash containing optional configuration values for main.cf.
+# The values are configured using postfix::mailalias.
+# Example: `{'nobody': {'ensure': 'present', 'recipient': 'root'}}`
+#
# @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)).
@@ -267,6 +272,7 @@
Optional[String] $ldap_options = undef,
Array[String[1]] $ldap_packages = [],
String $lookup_table_type = 'hash',
+ Hash $mailaliases = {},
String $mail_user = 'vmail', # postfix_mail_user
Boolean $mailman = false,
String $mailx_ensure = 'present',
@@ -333,6 +339,12 @@
}
}
+ $mailaliases.each |$key, $value| {
+ postfix::mailalias { $key:
+ * => $value,
+ }
+ }
+
$transports.each |$key, $value| {
postfix::transport { $key:
* => $value,