Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow initial content for virtual and transport if mta is true #396

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ The following parameters are available in the `postfix` class:
* [`masquerade_domains`](#-postfix--masquerade_domains)
* [`masquerade_exceptions`](#-postfix--masquerade_exceptions)
* [`mta`](#-postfix--mta)
* [`mta_virtual_content`](#-postfix--mta_virtual_content)
* [`mta_virtual_source`](#-postfix--mta_virtual_source)
* [`mta_transport_content`](#-postfix--mta_transport_content)
* [`mta_transport_source`](#-postfix--mta_transport_source)
* [`mydestination`](#-postfix--mydestination)
* [`mynetworks`](#-postfix--mynetworks)
* [`myorigin`](#-postfix--myorigin)
Expand Down Expand Up @@ -477,6 +481,42 @@ This option is mutually exclusive with the satellite Boolean.

Default value: `false`

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

Data type: `Optional[String]`

A free form string that defines the contents of the virtual file. Only used if mta is true.
This parameter is mutually exclusive with mta_virtual_source.

Default value: `undef`

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

Data type: `Optional[String]`

A String whose value is a location for the source file to be used for the virtual file.
Only used if mta is true. This parameter is mutually exclusive with mta_virtual_content.

Default value: `undef`

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

Data type: `Optional[String]`

A free form string that defines the contents of the transport file. Only used if mta is true.
This parameter is mutually exclusive with mta_transport_source.

Default value: `undef`

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

Data type: `Optional[String]`

A String whose value is a location for the source file to be used for the transport file.
Only used if mta is true. This parameter is mutually exclusive with mta_transport_content.

Default value: `undef`

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

Data type: `String`
Expand Down
28 changes: 28 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,22 @@
# A Boolean to define whether to configure Postfix as a mail transfer agent.
# This option is mutually exclusive with the satellite Boolean.
#
# @param mta_virtual_content
# A free form string that defines the contents of the virtual file. Only used if mta is true.
# This parameter is mutually exclusive with mta_virtual_source.
#
# @param mta_virtual_source
# A String whose value is a location for the source file to be used for the virtual file.
# Only used if mta is true. This parameter is mutually exclusive with mta_virtual_content.
#
# @param mta_transport_content
# A free form string that defines the contents of the transport file. Only used if mta is true.
# This parameter is mutually exclusive with mta_transport_source.
#
# @param mta_transport_source
# A String whose value is a location for the source file to be used for the transport file.
# Only used if mta is true. This parameter is mutually exclusive with mta_transport_content.
#
# @param mydestination
# A string to define the mydestination parameter in main.cf (postconf(5)).
# Example: `example.com, foo.example.com`.
Expand Down Expand Up @@ -286,6 +302,10 @@
Optional[Array[String[1]]] $masquerade_domains = undef,
Optional[Array[String[1]]] $masquerade_exceptions = undef,
Boolean $mta = false,
Optional[String] $mta_virtual_content = undef,
Optional[String] $mta_virtual_source = undef,
Optional[String] $mta_transport_content = undef,
Optional[String] $mta_transport_source = undef,
String $mydestination = '$myhostname, localhost.$mydomain, localhost', # postfix_mydestination
String $mynetworks = '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128', # postfix_mynetworks
String $myorigin = $facts['networking']['fqdn'],
Expand Down Expand Up @@ -371,6 +391,14 @@
include postfix::ldap
}

if $mta_virtual_content and $mta_virtual_source {
fail('You must provide either \'mta_virtual_content\' or \'mta_virtual_source\', not both.')
}

if $mta_transport_content and $mta_transport_source {
fail('You must provide either \'mta_transport_content\' or \'mta_transport_source\', not both.')
}

if $mta {
if $satellite {
fail('enabling both the $mta and $satellite parameters is not supported. Please disable one.')
Expand Down
8 changes: 6 additions & 2 deletions manifests/mta.pp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@
}

postfix::hash { "${postfix::confdir}/virtual":
ensure => 'present',
ensure => 'present',
content => $postfix::mta_virtual_content,
source => $postfix::mta_virtual_source,
}

postfix::hash { "${postfix::confdir}/transport":
ensure => 'present',
ensure => 'present',
content => $postfix::mta_transport_content,
source => $postfix::mta_transport_source,
}
}
Loading