Skip to content

Commit

Permalink
Merge pull request #400 from peelman/master
Browse files Browse the repository at this point in the history
Allow mailaliases to be managed via hiera
  • Loading branch information
kenyon authored Aug 26, 2024
2 parents 4ab126b + c096edd commit 7985c04
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -275,6 +276,16 @@ Type has to be supported by system, see "postconf -m" for supported types.

Default value: `'hash'`

##### <a name="-postfix--mailaliases"></a>`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: `{}`

##### <a name="-postfix--mail_user"></a>`mail_user`

Data type: `String`
Expand Down
12 changes: 12 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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)).
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -333,6 +339,12 @@
}
}

$mailaliases.each |$key, $value| {
postfix::mailalias { $key:
* => $value,
}
}

$transports.each |$key, $value| {
postfix::transport { $key:
* => $value,
Expand Down

0 comments on commit 7985c04

Please sign in to comment.