Skip to content

Commit

Permalink
make it possible to provide inital seed data for the virtual and tran…
Browse files Browse the repository at this point in the history
…sport files that will be setup if you set mta to true
  • Loading branch information
edrude committed Aug 2, 2024
1 parent d4058dc commit ed9e4a1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
24 changes: 24 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,18 @@
# 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 +298,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 +387,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
6 changes: 5 additions & 1 deletion 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',
content => $postfix::mta_transport_content,
source => $postfix::mta_transport_source,
}
}

0 comments on commit ed9e4a1

Please sign in to comment.